X-Git-Url: http://git.veekun.com/zzz-floof.git/blobdiff_plain/e080215f07b8153ef01d6c840a4ba3a4bfc2d770..68a31d533aba7490c3f1f812075e8ab6eb9265d0:/floof/lib/base.py diff --git a/floof/lib/base.py b/floof/lib/base.py index fd6ee47..d2756ba 100644 --- a/floof/lib/base.py +++ b/floof/lib/base.py @@ -2,13 +2,22 @@ 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 floof import model from floof.model import meta class BaseController(WSGIController): + def __before__(self, action, **params): + # Fetch current user object + try: + c.user = meta.Session.query(model.User).get(session['user_id']) + except: + pass + def __call__(self, environ, start_response): """Invoke the Controller""" # WSGIController.__call__ dispatches to the Controller method