Mercurial > public > src > rhodecode
comparison pylons_app/lib/app_globals.py @ 364:1ef52a70f3b7
Made config file free configuration based on database and capable of beeing manage via application settings + some code cleanups
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 14 Jul 2010 02:28:32 +0200 |
parents | 48727add84c9 |
children | 0d4fceb91c9c |
comparison
equal
deleted
inserted
replaced
362:71f25781079d | 364:1ef52a70f3b7 |
---|---|
1 """The application's Globals object""" | 1 """The application's Globals object""" |
2 | 2 |
3 from beaker.cache import CacheManager | 3 from beaker.cache import CacheManager |
4 from beaker.util import parse_cache_config_options | 4 from beaker.util import parse_cache_config_options |
5 from pylons_app.lib.utils import make_ui | 5 from vcs.utils.lazy import LazyProperty |
6 | 6 |
7 class Globals(object): | 7 class Globals(object): |
8 | |
9 """Globals acts as a container for objects available throughout the | 8 """Globals acts as a container for objects available throughout the |
10 life of the application | 9 life of the application |
11 | 10 |
12 """ | 11 """ |
13 | 12 |
16 initialization and is available during requests via the | 15 initialization and is available during requests via the |
17 'app_globals' variable | 16 'app_globals' variable |
18 | 17 |
19 """ | 18 """ |
20 self.cache = CacheManager(**parse_cache_config_options(config)) | 19 self.cache = CacheManager(**parse_cache_config_options(config)) |
21 self.baseui = make_ui(config['hg_app_repo_conf']) | |
22 self.paths = self.baseui.configitems('paths') | |
23 self.base_path = self.paths[0][1].replace('*', '') | |
24 self.changeset_annotation_colors = {} | 20 self.changeset_annotation_colors = {} |
25 self.available_permissions = None # propagated after init_model | 21 self.available_permissions = None # propagated after init_model |
22 self.app_title = None # propagated after init_model | |
23 self.baseui = None # propagated after init_model | |
24 | |
25 @LazyProperty | |
26 def paths(self): | |
27 if self.baseui: | |
28 return self.baseui.configitems('paths') | |
29 | |
30 @LazyProperty | |
31 def base_path(self): | |
32 if self.baseui: | |
33 return self.paths[0][1].replace('*', '') |