Mercurial > kallithea
annotate pylons_app/lib/base.py @ 112:f7c403e89d5b
updated appglobals, to handle only the baseui config. removed hg app from it
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 28 Apr 2010 01:55:34 +0200 |
parents | 5e2470ebdbc6 |
children | 79a4f9f1cbd6 |
rev | line source |
---|---|
0 | 1 """The base Controller API |
2 | |
3 Provides the BaseController class for subclassing. | |
4 """ | |
5 from pylons.controllers import WSGIController | |
6 from pylons.templating import render_mako as render | |
7 from pylons_app.model import meta | |
107
5e2470ebdbc6
Added repo switcher, in base and long term caching for this.
Marcin Kuzminski <marcin@python-works.com>
parents:
51
diff
changeset
|
8 from beaker.cache import cache_region |
5e2470ebdbc6
Added repo switcher, in base and long term caching for this.
Marcin Kuzminski <marcin@python-works.com>
parents:
51
diff
changeset
|
9 from pylons import tmpl_context as c |
5e2470ebdbc6
Added repo switcher, in base and long term caching for this.
Marcin Kuzminski <marcin@python-works.com>
parents:
51
diff
changeset
|
10 from pylons_app.model.hg_model import HgModel |
0 | 11 |
12 class BaseController(WSGIController): | |
107
5e2470ebdbc6
Added repo switcher, in base and long term caching for this.
Marcin Kuzminski <marcin@python-works.com>
parents:
51
diff
changeset
|
13 def _load_repos(self): |
5e2470ebdbc6
Added repo switcher, in base and long term caching for this.
Marcin Kuzminski <marcin@python-works.com>
parents:
51
diff
changeset
|
14 |
5e2470ebdbc6
Added repo switcher, in base and long term caching for this.
Marcin Kuzminski <marcin@python-works.com>
parents:
51
diff
changeset
|
15 @cache_region('long_term', 'repo_list_2') |
5e2470ebdbc6
Added repo switcher, in base and long term caching for this.
Marcin Kuzminski <marcin@python-works.com>
parents:
51
diff
changeset
|
16 def _get_repos(): |
5e2470ebdbc6
Added repo switcher, in base and long term caching for this.
Marcin Kuzminski <marcin@python-works.com>
parents:
51
diff
changeset
|
17 return [rep['name'] for rep in HgModel().get_repos()] |
5e2470ebdbc6
Added repo switcher, in base and long term caching for this.
Marcin Kuzminski <marcin@python-works.com>
parents:
51
diff
changeset
|
18 |
5e2470ebdbc6
Added repo switcher, in base and long term caching for this.
Marcin Kuzminski <marcin@python-works.com>
parents:
51
diff
changeset
|
19 c.repo_list = _get_repos() |
5e2470ebdbc6
Added repo switcher, in base and long term caching for this.
Marcin Kuzminski <marcin@python-works.com>
parents:
51
diff
changeset
|
20 |
0 | 21 def __call__(self, environ, start_response): |
22 """Invoke the Controller""" | |
23 # WSGIController.__call__ dispatches to the Controller method | |
24 # the request is routed to. This routing information is | |
25 # available in environ['pylons.routes_dict'] | |
107
5e2470ebdbc6
Added repo switcher, in base and long term caching for this.
Marcin Kuzminski <marcin@python-works.com>
parents:
51
diff
changeset
|
26 self._load_repos() |
0 | 27 try: |
28 return WSGIController.__call__(self, environ, start_response) | |
29 finally: | |
51 | 30 meta.Session.remove() |