source: gutenbach-web/base.py @ 973dd91

debianmacno-cupsweb
Last change on this file since 973dd91 was 973dd91, checked in by Edward Z. Yang <edwardzyang@…>, 16 years ago

Initial commit.

Signed-off-by: Edward Z. Yang <edwardzyang@…>

  • Property mode set to 100644
File size: 1.1 KB
Line 
1"""The base Controller API
2
3Provides the BaseController class for subclassing.
4"""
5from tg import TGController, tmpl_context
6from tg.render import render
7from tg import request
8
9import sipbmp3web.model as model
10
11from pylons.i18n import _, ungettext, N_
12from tw.api import WidgetBunch
13
14class 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
21class 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)
Note: See TracBrowser for help on using the repository browser.