1 | """The base Controller API |
---|
2 | |
---|
3 | Provides the BaseController class for subclassing. |
---|
4 | """ |
---|
5 | from tg import TGController, tmpl_context |
---|
6 | from tg.render import render |
---|
7 | from tg import request |
---|
8 | |
---|
9 | import sipbmp3web.model as model |
---|
10 | |
---|
11 | from pylons.i18n import _, ungettext, N_ |
---|
12 | from tw.api import WidgetBunch |
---|
13 | |
---|
14 | class Controller(object): |
---|
15 | """Base class for a web application's controller. |
---|
16 | |
---|
17 | Currently, this provides positional parameters functionality |
---|
18 | via a standard default method. |
---|
19 | """ |
---|
20 | |
---|
21 | class BaseController(TGController): |
---|
22 | """Base class for the root of a web application. |
---|
23 | |
---|
24 | Your web application should have one of these. The root of |
---|
25 | your application is used to compute URLs used by your app. |
---|
26 | """ |
---|
27 | |
---|
28 | def __call__(self, environ, start_response): |
---|
29 | """Invoke the Controller""" |
---|
30 | # TGController.__call__ dispatches to the Controller method |
---|
31 | # the request is routed to. This routing information is |
---|
32 | # available in environ['pylons.routes_dict'] |
---|
33 | |
---|
34 | request.identity = request.environ.get('repoze.who.identity') |
---|
35 | tmpl_context.identity = request.identity |
---|
36 | return TGController.__call__(self, environ, start_response) |
---|