changeset 4156:40501b3e2176

Moved some attributes on Request into RenderContext
author Florian Krupicka <florian.krupicka@googlemail.com>
date Tue, 10 Jun 2008 20:56:46 +0200
parents 7e59a7989b23
children 264e5687ef1c
files MoinMoin/web/contexts.py MoinMoin/wsgiapp.py
diffstat 2 files changed, 13 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/web/contexts.py	Tue Jun 10 12:50:31 2008 +0200
+++ b/MoinMoin/web/contexts.py	Tue Jun 10 20:56:46 2008 +0200
@@ -14,6 +14,7 @@
 from werkzeug.exceptions import Unauthorized, NotFound
 
 from MoinMoin import i18n
+from MoinMoin.formatter import text_html
 from MoinMoin.request import RequestBase
 from MoinMoin.web.request import Request
 from MoinMoin.web.utils import check_spider
@@ -235,7 +236,6 @@
     """ Context for rendering content
     
     Contains code related to the representation of pages:
-    * getText function
     * formatters
     * theme
     * page
@@ -245,6 +245,17 @@
         Context.__init__(self, parent)
         self.page = page
         self.user = user
+
+        self.pragma = {}
+        self.mode_getpagelinks = 0
+        self.parsePageLinks_running = {}
+        self.content_lang = self.cfg.language_default
+        
+        self.html_formatter = text_html.Formatter(self)
+        self.formatter = self.html_formatter
+
+        if i18n.languages is None:
+            i18n.i18n_init(self)
     
     def lang(self):
         if self.user.valid and self.user.language:
--- a/MoinMoin/wsgiapp.py	Tue Jun 10 12:50:31 2008 +0200
+++ b/MoinMoin/wsgiapp.py	Tue Jun 10 20:56:46 2008 +0200
@@ -45,10 +45,6 @@
     from MoinMoin.Page import RootPage
     request.rootpage = RootPage(request)
 
-    from MoinMoin import i18n
-    request.i18n = i18n
-    i18n.i18n_init(request)
-
     user_obj = request.cfg.session_handler.start(request, request.cfg.session_id_handler)
     
     request.user = None
@@ -71,19 +67,9 @@
         if not request.forbidden and request.surge_protect():
             raise SurgeProtection(retry_after=request.cfg.surge_lockout_time)
 
-    request.pragma = {}
-    request.mode_getpagelinks = 0 # is > 0 as long as we are in a getPageLinks call
-    request.parsePageLinks_running = {} # avoid infinite recursion by remembering what we are already running
-
-    request.content_lang = request.cfg.language_default
-
     request.reset()
 
-    from MoinMoin.formatter.text_html import Formatter
-    request.html_formatter = Formatter(request)
-    request.formatter = request.html_formatter
-
-    request.clock.stop('base__init__')    
+    request.clock.stop('base__init__')
 
 def application(environ, start_response):
     request = Request(environ)