Mercurial > kallithea
annotate pylons_app/lib/base.py @ 280:373ddb868bd6
html updates,mostly tables
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 13 Jun 2010 18:18:49 +0200 |
parents | a83a1799480c |
children | d303aacb3349 |
rev | line source |
---|---|
0 | 1 """The base Controller API |
2 | |
3 Provides the BaseController class for subclassing. | |
4 """ | |
185
3380ca40cdba
added version generation to pylons_app and showed it into template. Propagated baseController with some data for acces into each controller. Fixed simplehg middleware to get proper name of application
Marcin Kuzminski <marcin@python-works.com>
parents:
169
diff
changeset
|
5 from pylons import config, tmpl_context as c, request, session |
0 | 6 from pylons.controllers import WSGIController |
7 from pylons.templating import render_mako as render | |
185
3380ca40cdba
added version generation to pylons_app and showed it into template. Propagated baseController with some data for acces into each controller. Fixed simplehg middleware to get proper name of application
Marcin Kuzminski <marcin@python-works.com>
parents:
169
diff
changeset
|
8 from pylons_app.lib.auth import LoginRequired, AuthUser |
3380ca40cdba
added version generation to pylons_app and showed it into template. Propagated baseController with some data for acces into each controller. Fixed simplehg middleware to get proper name of application
Marcin Kuzminski <marcin@python-works.com>
parents:
169
diff
changeset
|
9 from pylons_app.lib.utils import get_repo_slug |
0 | 10 from pylons_app.model import meta |
245
a83a1799480c
Reimplemented way of caching repos list, hg model now get's repos objects right from cached dict, this way we skipp creating instances of MercurialRepository and gain performance. Some import cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
224
diff
changeset
|
11 from pylons_app.model.hg_model import _get_repos_cached |
224
fdcef6ea3b55
Added readme, and changed version display
Marcin Kuzminski <marcin@python-works.com>
parents:
196
diff
changeset
|
12 from pylons_app import __version__ |
0 | 13 |
14 class BaseController(WSGIController): | |
185
3380ca40cdba
added version generation to pylons_app and showed it into template. Propagated baseController with some data for acces into each controller. Fixed simplehg middleware to get proper name of application
Marcin Kuzminski <marcin@python-works.com>
parents:
169
diff
changeset
|
15 |
3380ca40cdba
added version generation to pylons_app and showed it into template. Propagated baseController with some data for acces into each controller. Fixed simplehg middleware to get proper name of application
Marcin Kuzminski <marcin@python-works.com>
parents:
169
diff
changeset
|
16 def __before__(self): |
224
fdcef6ea3b55
Added readme, and changed version display
Marcin Kuzminski <marcin@python-works.com>
parents:
196
diff
changeset
|
17 c.hg_app_version = __version__ |
185
3380ca40cdba
added version generation to pylons_app and showed it into template. Propagated baseController with some data for acces into each controller. Fixed simplehg middleware to get proper name of application
Marcin Kuzminski <marcin@python-works.com>
parents:
169
diff
changeset
|
18 c.repos_prefix = config['hg_app_name'] |
3380ca40cdba
added version generation to pylons_app and showed it into template. Propagated baseController with some data for acces into each controller. Fixed simplehg middleware to get proper name of application
Marcin Kuzminski <marcin@python-works.com>
parents:
169
diff
changeset
|
19 c.repo_name = get_repo_slug(request) |
3380ca40cdba
added version generation to pylons_app and showed it into template. Propagated baseController with some data for acces into each controller. Fixed simplehg middleware to get proper name of application
Marcin Kuzminski <marcin@python-works.com>
parents:
169
diff
changeset
|
20 c.hg_app_user = session.get('hg_app_user', AuthUser()) |
3380ca40cdba
added version generation to pylons_app and showed it into template. Propagated baseController with some data for acces into each controller. Fixed simplehg middleware to get proper name of application
Marcin Kuzminski <marcin@python-works.com>
parents:
169
diff
changeset
|
21 c.cached_repo_list = _get_repos_cached() |
3380ca40cdba
added version generation to pylons_app and showed it into template. Propagated baseController with some data for acces into each controller. Fixed simplehg middleware to get proper name of application
Marcin Kuzminski <marcin@python-works.com>
parents:
169
diff
changeset
|
22 self.sa = meta.Session |
3380ca40cdba
added version generation to pylons_app and showed it into template. Propagated baseController with some data for acces into each controller. Fixed simplehg middleware to get proper name of application
Marcin Kuzminski <marcin@python-works.com>
parents:
169
diff
changeset
|
23 |
0 | 24 def __call__(self, environ, start_response): |
25 """Invoke the Controller""" | |
26 # WSGIController.__call__ dispatches to the Controller method | |
27 # the request is routed to. This routing information is | |
28 # available in environ['pylons.routes_dict'] | |
29 try: | |
30 return WSGIController.__call__(self, environ, start_response) | |
31 finally: | |
51 | 32 meta.Session.remove() |