vigiboard / dashboard / lib / base.py @ 805cc54a
History | View | Annotate | Download (995 Bytes)
1 |
# -*- coding: utf-8 -*-
|
---|---|
2 |
|
3 |
"""The base Controller API."""
|
4 |
|
5 |
from tg import TGController, tmpl_context |
6 |
from tg.render import render |
7 |
from tg import request |
8 |
from pylons.i18n import _, ungettext, N_ |
9 |
from tw.api import WidgetBunch |
10 |
import dashboard.model as model |
11 |
|
12 |
__all__ = ['Controller', 'BaseController'] |
13 |
|
14 |
|
15 |
class BaseController(TGController): |
16 |
"""
|
17 |
Base class for the controllers in the application.
|
18 |
|
19 |
Your web application should have one of these. The root of
|
20 |
your application is used to compute URLs used by your app.
|
21 |
|
22 |
"""
|
23 |
|
24 |
def __call__(self, environ, start_response): |
25 |
"""Invoke the Controller"""
|
26 |
# TGController.__call__ dispatches to the Controller method
|
27 |
# the request is routed to. This routing information is
|
28 |
# available in environ['pylons.routes_dict']
|
29 |
|
30 |
request.identity = request.environ.get('repoze.who.identity')
|
31 |
tmpl_context.identity = request.identity |
32 |
return TGController.__call__(self, environ, start_response) |