How can I create the global c variable that is used in the templates
if I'm in an WSGI app and not in a controller response method?
With the WSGI dispatch, I need to rewrite some of the output using
Genshi, so I have the following code:
class EmbeddedtracController(BaseController):
def __init__(self):
# set application to the trac WSGI dispatch_request function
self.app = dispatch_request
self.trac_env_path = config['trac_env_path']
def __call__(self, environ, start_response):
"""Dispatches request to trac."""
...
self.rewriteLoginPage(environ, strHtml)
...
def _rewriteLoginPage(self, environ, strHtml):
"""Handles the 403 Forbidden response."""
# Set variables for Genshi
c.input = strHtml
...
return render("genshi", "TracLogin")
which results in the following error message:
c.input = strHtml
File 'c:\\python25\\lib\\site-packages\\paste-1.7.1-py2.5.egg\\paste\
\registry.py', line 140 in __setattr__
setattr(self._current_obj(), attr, value)
File 'c:\\python25\\lib\\site-packages\\paste-1.7.1-py2.5.egg\\paste\
\registry.py', line 194 in _current_obj
'thread' % self.____name__)
TypeError: No object (name: C) has been registered for this thread
Thanks,
Eric
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---