diff --git a/rhodecode/config/environment.py b/rhodecode/config/environment.py --- a/rhodecode/config/environment.py +++ b/rhodecode/config/environment.py @@ -6,18 +6,18 @@ import logging from mako.lookup import TemplateLookup from pylons.configuration import PylonsConfig from pylons.error import handle_mako_error -from sqlalchemy import engine_from_config import rhodecode.lib.app_globals as app_globals import rhodecode.lib.helpers from rhodecode.config.routing import make_map from rhodecode.lib import celerypylons -from rhodecode.lib.auth import set_available_permissions, set_base_path +from rhodecode.lib import engine_from_config +from rhodecode.lib.timerproxy import TimerProxy +from rhodecode.lib.auth import set_available_permissions from rhodecode.lib.utils import repo2db_mapper, make_ui, set_rhodecode_config from rhodecode.model import init_model from rhodecode.model.scm import ScmModel -from rhodecode.lib.timerproxy import TimerProxy log = logging.getLogger(__name__) @@ -61,25 +61,18 @@ def load_environment(global_conf, app_co from rhodecode.lib.utils import create_test_env, create_test_index from rhodecode.tests import TESTS_TMP_PATH create_test_env(TESTS_TMP_PATH, config) - create_test_index(TESTS_TMP_PATH, True) + create_test_index(TESTS_TMP_PATH, config, True) #MULTIPLE DB configs # Setup the SQLAlchemy database engine - if config['debug'] and not test: - #use query time debugging. - sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.', - proxy=TimerProxy()) - else: - sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.') + sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.') init_model(sa_engine_db1) - #init baseui - config['pylons.app_globals'].baseui = make_ui('db') - g = config['pylons.app_globals'] - repo2db_mapper(ScmModel().repo_scan(g.paths[0][1], g.baseui)) + repos_path = make_ui('db').configitems('paths')[0][1] + repo2db_mapper(ScmModel().repo_scan(repos_path)) set_available_permissions(config) - set_base_path(config) + config['base_path'] = repos_path set_rhodecode_config(config) # CONFIGURATION OPTIONS HERE (note: all config options will override # any Pylons config options)