4de5e19450976a012097b37f619a1aed320a28f1
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
.model
.users
import User
11 class BaseController(WSGIController
):
13 def __before__(self
, action
, **params
):
14 # Fetch current user object
16 c
.user
= User
.query
.get(session
['user_id'])
20 def __call__(self
, environ
, start_response
):
21 """Invoke the Controller"""
22 # WSGIController.__call__ dispatches to the Controller method
23 # the request is routed to. This routing information is
24 # available in environ['pylons.routes_dict']
25 return WSGIController
.__call__(self
, environ
, start_response
)