changeset 2217:f8dcc3232e8b

move html_formatter creation to RequestBase.__init__ so it also works for CLI requests
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 26 May 2007 17:39:21 +0200
parents 28d8d384d24d
children c391df32467f
files MoinMoin/request/__init__.py MoinMoin/wikiutil.py
diffstat 2 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/request/__init__.py	Thu Jun 21 09:23:44 2007 +0200
+++ b/MoinMoin/request/__init__.py	Sat May 26 17:39:21 2007 +0200
@@ -259,6 +259,11 @@
             self.getText = lambda text, i18n=self.i18n, request=self, lang=self.lang, **kv: i18n.getText(text, request, lang, kv.get('formatted', True))
 
             self.reset()
+
+            from MoinMoin.formatter.text_html import Formatter
+            self.html_formatter = Formatter(self)
+            self.formatter = self.html_formatter
+
             self.clock.stop('base__init__')
 
     def surge_protect(self, kick_him=False):
@@ -1156,9 +1161,6 @@
         self.clock.start('run')
 
         from MoinMoin.Page import Page
-        from MoinMoin.formatter.text_html import Formatter
-        self.html_formatter = Formatter(self)
-        self.formatter = self.html_formatter
 
         self.initTheme()
 
--- a/MoinMoin/wikiutil.py	Thu Jun 21 09:23:44 2007 +0200
+++ b/MoinMoin/wikiutil.py	Sat May 26 17:39:21 2007 +0200
@@ -1537,8 +1537,7 @@
     @return: formatted link tag
     """
     if formatter is None:
-        from MoinMoin.formatter.text_html import Formatter
-        formatter = Formatter(request)
+        formatter = request.html_formatter
     if 'css_class' in kw:
         css_class = kw['css_class']
         del kw['css_class'] # one time is enough