I want to log the controller and action when a request comes, so I write a __before__
in the base controller:
开发者_如何转开发 class BaseController:
__before__(self):
controller = get_controller(request)
action = get_action(request)
logger.log('%s - %s'%(controller, action))
But I don't know how to get the controller
and action
just from the request
params = request.environ['pylons.routes_dict']
print dir(params)
#-> {'action':u'action', 'controller':u'controller'}
精彩评论