+
+ # Insert any code to be run per request here.
+
+ try:
+ return WSGIController.__call__(self, environ, start_response)
+ finally:
+ model.Session.remove()
+
+
+ def redirect_to_referrer(self):
+ """Performs a redirect_to to wherever we came from. Used for stuff
+ like logging in.
+ """
+ referrer = request.headers.get('REFERER', '/')
+ redirect(referrer, code=302)