Mercurial > kallithea
comparison rhodecode/config/environment.py @ 1018:da5075ce681c beta
rhodecode config module refactoring
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 10 Feb 2011 22:41:30 +0100 |
parents | 02246101c846 |
children | 405b80e4ccd5 |
comparison
equal
deleted
inserted
replaced
1017:ade3414a8b61 | 1018:da5075ce681c |
---|---|
4 import logging | 4 import logging |
5 | 5 |
6 from mako.lookup import TemplateLookup | 6 from mako.lookup import TemplateLookup |
7 from pylons.configuration import PylonsConfig | 7 from pylons.configuration import PylonsConfig |
8 from pylons.error import handle_mako_error | 8 from pylons.error import handle_mako_error |
9 from sqlalchemy import engine_from_config | |
9 | 10 |
10 import rhodecode.lib.app_globals as app_globals | 11 import rhodecode.lib.app_globals as app_globals |
11 import rhodecode.lib.helpers | 12 import rhodecode.lib.helpers |
12 | 13 |
13 from rhodecode.config.routing import make_map | 14 from rhodecode.config.routing import make_map |
14 from rhodecode.lib import celerypylons | 15 from rhodecode.lib import celerypylons |
15 from rhodecode.lib.auth import set_available_permissions, set_base_path | 16 from rhodecode.lib.auth import set_available_permissions, set_base_path |
16 from rhodecode.lib.utils import repo2db_mapper, make_ui, set_rhodecode_config | 17 from rhodecode.lib.utils import repo2db_mapper, make_ui, set_rhodecode_config |
17 from rhodecode.model import init_model | 18 from rhodecode.model import init_model |
18 from rhodecode.model.scm import ScmModel | 19 from rhodecode.model.scm import ScmModel |
19 from sqlalchemy import engine_from_config | 20 from rhodecode.lib.timerproxy import TimerProxy |
20 | 21 |
21 log = logging.getLogger(__name__) | 22 log = logging.getLogger(__name__) |
22 | 23 |
23 def load_environment(global_conf, app_conf, initial=False): | 24 def load_environment(global_conf, app_conf, initial=False): |
24 """Configure the Pylons environment via the ``pylons.config`` | 25 """Configure the Pylons environment via the ``pylons.config`` |
63 | 64 |
64 #MULTIPLE DB configs | 65 #MULTIPLE DB configs |
65 # Setup the SQLAlchemy database engine | 66 # Setup the SQLAlchemy database engine |
66 if config['debug'] and not test: | 67 if config['debug'] and not test: |
67 #use query time debugging. | 68 #use query time debugging. |
68 from rhodecode.lib.timerproxy import TimerProxy | |
69 sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.', | 69 sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.', |
70 proxy=TimerProxy()) | 70 proxy=TimerProxy()) |
71 else: | 71 else: |
72 sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.') | 72 sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.') |
73 | 73 |