1 """The base Controller API
3 Provides the BaseController class for subclassing.
5 from pylons
import session
, tmpl_context
as c
6 from pylons
.controllers
import WSGIController
7 from pylons
.templating
import render_mako
as render
9 from floof
import model
10 from floof
.model
import meta
12 class BaseController(WSGIController
):
14 def __before__(self
, action
, **params
):
15 # Fetch current user object
17 c
.user
= meta
.Session
.query(model
.User
).get(session
['user_id'])
21 def __call__(self
, environ
, start_response
):
22 """Invoke the Controller"""
23 # WSGIController.__call__ dispatches to the Controller method
24 # the request is routed to. This routing information is
25 # available in environ['pylons.routes_dict']
27 return WSGIController
.__call__(self
, environ
, start_response
)