Author: chrisz
Date: Mon Jan 17 13:48:51 2011
New Revision: 7207
URL: http://trac.turbogears.org/changeset/7207

Log:
Fixed two problems in the startup module.

Modified:
   branches/1.5/turbogears/startup.py

Modified: branches/1.5/turbogears/startup.py
==============================================================================
--- branches/1.5/turbogears/startup.py  Mon Jan 17 10:01:39 2011        (r7206)
+++ branches/1.5/turbogears/startup.py  Mon Jan 17 13:48:51 2011        (r7207)
@@ -106,7 +106,7 @@
 def config_root():
     """Configure the encoding and virtual path for the root controller."""
     global webpath
-    encoding = config.get(' genshi.default_encoding ',
+    encoding = config.get('genshi.default_encoding',
         config.get('kid.encoding', 'utf-8'))
     config.update({'/': {
         'tools.decode.on': True,
@@ -161,12 +161,16 @@
     config_static()
     config_root()
     if config.get('visit.on', False):
-        cherrypy.tools.visit = cherrypy.Tool('before_handler', VisitTool())
+        # The VisitTool needs to happen after cherrypy.tools.decode
+        # so that request params are properly decoded before it runs,
+        # but it must run before the NestedVariablesHook to work properly
+        cherrypy.tools.visit = cherrypy.Tool(
+            'before_handler', VisitTool(), priority=55)
     hooks = cherrypy.request.hooks
     hooks.attach('before_finalize', verify_identity_status)
     hooks.attach('on_end_resource', database.EndTransactions)
     # The NestedVariablesHook needs to happen after cherrypy.tools.decode
-    # in order to be decoded properly.
+    # so that request params are properly decoded before it runs
     hooks.attach('before_handler', NestedVariablesHook, priority=60)
 
     # Register server with Bonjour framework

Reply via email to