Mercurial > kallithea
comparison pylons_app/lib/base.py @ 373:3171614c0067
Added permissions check on repo switcher,
and cached that for super short cache.
repo switcher css updates
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 28 Jul 2010 02:25:47 +0200 |
parents | e9a6783f5502 |
children | 55377fdc1fc6 |
comparison
equal
deleted
inserted
replaced
372:1fa58ca0a77e | 373:3171614c0067 |
---|---|
3 Provides the BaseController class for subclassing. | 3 Provides the BaseController class for subclassing. |
4 """ | 4 """ |
5 from pylons import config, tmpl_context as c, request, session | 5 from pylons import config, tmpl_context as c, request, session |
6 from pylons.controllers import WSGIController | 6 from pylons.controllers import WSGIController |
7 from pylons.templating import render_mako as render | 7 from pylons.templating import render_mako as render |
8 from pylons_app import __version__ | |
8 from pylons_app.lib import auth | 9 from pylons_app.lib import auth |
9 from pylons_app.lib.utils import get_repo_slug | 10 from pylons_app.lib.utils import get_repo_slug |
10 from pylons_app.model import meta | 11 from pylons_app.model import meta |
11 from pylons_app.model.hg_model import _get_repos_cached | 12 from pylons_app.model.hg_model import _get_repos_cached, \ |
12 from pylons_app import __version__ | 13 _get_repos_switcher_cached |
13 | 14 |
14 class BaseController(WSGIController): | 15 class BaseController(WSGIController): |
15 | 16 |
16 def __before__(self): | 17 def __before__(self): |
17 c.hg_app_version = __version__ | 18 c.hg_app_version = __version__ |
18 c.hg_app_name = config['hg_app_name'] | 19 c.hg_app_name = config['hg_app_name'] |
19 c.repo_name = get_repo_slug(request) | 20 c.repo_name = get_repo_slug(request) |
20 c.cached_repo_list = _get_repos_cached() | 21 c.cached_repo_list = _get_repos_cached() |
22 c.repo_switcher_list = _get_repos_switcher_cached(c.cached_repo_list) | |
21 self.sa = meta.Session | 23 self.sa = meta.Session |
22 | 24 |
23 def __call__(self, environ, start_response): | 25 def __call__(self, environ, start_response): |
24 """Invoke the Controller""" | 26 """Invoke the Controller""" |
25 # WSGIController.__call__ dispatches to the Controller method | 27 # WSGIController.__call__ dispatches to the Controller method |