Le 21/10/2010 11:39, Stéphane Klein a écrit :
Where is the good place to always execute a code after all HTTP requests
execution ?
Answer on IRC :
<harobed> hi, Where is the good place to always execute a code after all
HTTP requests execution ?
<mgedmin> wsgi middleware would be an option
<mgedmin> or you could do that thing in your BaseController.__call__
<harobed> ok, I see it
In lib/base.py, I put this code :
class BaseController(WSGIController):
...
def __call__(self, environ, start_response):
"""Invoke the Controller"""
# WSGIController.__call__ dispatches to the Controller method
# the request is routed to. This routing information is
# available in environ['pylons.routes_dict']
try:
return WSGIController.__call__(self, environ, start_response)
finally:
print('Foobar')
meta.Session.remove()
Here, "Foobar" is printed in console after all request.
Regards,
Stephane
--
Stéphane Klein <[email protected]> - French
blog: http://stephane-klein.info
twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.com
--
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.