Mercurial > kallithea
comparison rhodecode/lib/app_globals.py @ 547:1e757ac98988
renamed project to rhodecode
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 06 Oct 2010 03:18:16 +0200 |
parents | pylons_app/lib/app_globals.py@0d4fceb91c9c |
children | 05528ad948c4 |
comparison
equal
deleted
inserted
replaced
546:7c2f5e4d7bbf | 547:1e757ac98988 |
---|---|
1 """The application's Globals object""" | |
2 | |
3 from beaker.cache import CacheManager | |
4 from beaker.util import parse_cache_config_options | |
5 from vcs.utils.lazy import LazyProperty | |
6 | |
7 class Globals(object): | |
8 """Globals acts as a container for objects available throughout the | |
9 life of the application | |
10 | |
11 """ | |
12 | |
13 def __init__(self, config): | |
14 """One instance of Globals is created during application | |
15 initialization and is available during requests via the | |
16 'app_globals' variable | |
17 | |
18 """ | |
19 self.cache = CacheManager(**parse_cache_config_options(config)) | |
20 self.available_permissions = None # propagated after init_model | |
21 self.baseui = None # propagated after init_model | |
22 | |
23 @LazyProperty | |
24 def paths(self): | |
25 if self.baseui: | |
26 return self.baseui.configitems('paths') | |
27 | |
28 @LazyProperty | |
29 def base_path(self): | |
30 if self.baseui: | |
31 return self.paths[0][1].replace('*', '') |