X-Git-Url: http://git.veekun.com/zzz-floof.git/blobdiff_plain/7913f8d5b2d58dbd8db4503378eddb00578e90a7..6fb3ad2a578aa2e0eced735187a02a79a8907668:/floof/lib/base.py diff --git a/floof/lib/base.py b/floof/lib/base.py index 4de5e19..cb7c746 100644 --- a/floof/lib/base.py +++ b/floof/lib/base.py @@ -2,14 +2,17 @@ Provides the BaseController class for subclassing. """ -from pylons import session, tmpl_context as c from pylons.controllers import WSGIController from pylons.templating import render_mako as render +from pylons import config +from floof import model +from pylons import session, tmpl_context as c from floof.model.users import User class BaseController(WSGIController): + # NOTE: This could have been implemented as a middleware =] def __before__(self, action, **params): # Fetch current user object try: @@ -22,4 +25,10 @@ class BaseController(WSGIController): # WSGIController.__call__ dispatches to the Controller method # the request is routed to. This routing information is # available in environ['pylons.routes_dict'] - return WSGIController.__call__(self, environ, start_response) + + # Insert any code to be run per request here. + + try: + return WSGIController.__call__(self, environ, start_response) + finally: + model.Session.remove()