app_globals.py
23 lines
| 744 B
| text/x-python
|
PythonLexer
|
r0 | """The application's Globals object""" | ||
r113 | ||||
r43 | from beaker.cache import CacheManager | |||
from beaker.util import parse_cache_config_options | ||||
r112 | from pylons_app.lib.utils import make_ui | |||
r43 | ||||
|
r0 | class Globals(object): | ||
"""Globals acts as a container for objects available throughout the | ||||
life of the application | ||||
""" | ||||
r43 | def __init__(self, config): | |||
|
r0 | """One instance of Globals is created during application | ||
initialization and is available during requests via the | ||||
'app_globals' variable | ||||
""" | ||||
r43 | self.cache = CacheManager(**parse_cache_config_options(config)) | |||
r112 | self.baseui = make_ui('hgwebdir.config') | |||
self.paths = self.baseui.configitems('paths') | ||||
r93 | self.base_path = self.paths[0][1].replace('*', '') | |||