comparison rhodecode/config/environment.py @ 3960:5293d4bbb1ea

Merged dev into stable/default/master branch
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 07 Jun 2013 00:31:11 +0200
parents 3563bb7b4b82 07f8039ef090
children ffd45b185016
comparison
equal deleted inserted replaced
3879:51596d9ef2f8 3960:5293d4bbb1ea
16 from rhodecode.config.routing import make_map 16 from rhodecode.config.routing import make_map
17 17
18 from rhodecode.lib import helpers 18 from rhodecode.lib import helpers
19 from rhodecode.lib.auth import set_available_permissions 19 from rhodecode.lib.auth import set_available_permissions
20 from rhodecode.lib.utils import repo2db_mapper, make_ui, set_rhodecode_config,\ 20 from rhodecode.lib.utils import repo2db_mapper, make_ui, set_rhodecode_config,\
21 load_rcextensions, check_git_version 21 load_rcextensions, check_git_version, set_vcs_config
22 from rhodecode.lib.utils2 import engine_from_config, str2bool 22 from rhodecode.lib.utils2 import engine_from_config, str2bool
23 from rhodecode.lib.db_manage import DbManage 23 from rhodecode.lib.db_manage import DbManage
24 from rhodecode.model import init_model 24 from rhodecode.model import init_model
25 from rhodecode.model.scm import ScmModel 25 from rhodecode.model.scm import ScmModel
26 26
85 create_test_env(TESTS_TMP_PATH, config) 85 create_test_env(TESTS_TMP_PATH, config)
86 # set RC_WHOOSH_TEST_DISABLE=1 to disable whoosh index during tests 86 # set RC_WHOOSH_TEST_DISABLE=1 to disable whoosh index during tests
87 if not int(os.environ.get('RC_WHOOSH_TEST_DISABLE', 0)): 87 if not int(os.environ.get('RC_WHOOSH_TEST_DISABLE', 0)):
88 create_test_index(TESTS_TMP_PATH, config, True) 88 create_test_index(TESTS_TMP_PATH, config, True)
89 89
90 #check git version
91 check_git_version()
92 DbManage.check_waitress() 90 DbManage.check_waitress()
93 # MULTIPLE DB configs 91 # MULTIPLE DB configs
94 # Setup the SQLAlchemy database engine 92 # Setup the SQLAlchemy database engine
95 sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.') 93 sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.')
96 init_model(sa_engine_db1) 94 init_model(sa_engine_db1)
97 95
96 set_available_permissions(config)
98 repos_path = make_ui('db').configitems('paths')[0][1] 97 repos_path = make_ui('db').configitems('paths')[0][1]
99 repo2db_mapper(ScmModel().repo_scan(repos_path),
100 remove_obsolete=False, install_git_hook=False)
101 set_available_permissions(config)
102 config['base_path'] = repos_path 98 config['base_path'] = repos_path
103 set_rhodecode_config(config) 99 set_rhodecode_config(config)
104 100
105 instance_id = rhodecode.CONFIG.get('instance_id') 101 instance_id = rhodecode.CONFIG.get('instance_id')
106 if instance_id == '*': 102 if instance_id == '*':
111 # any Pylons config options) 107 # any Pylons config options)
112 108
113 # store config reference into our module to skip import magic of 109 # store config reference into our module to skip import magic of
114 # pylons 110 # pylons
115 rhodecode.CONFIG.update(config) 111 rhodecode.CONFIG.update(config)
112 set_vcs_config(rhodecode.CONFIG)
113
114 #check git version
115 check_git_version()
116
117 if str2bool(config.get('initial_repo_scan', True)):
118 repo2db_mapper(ScmModel().repo_scan(repos_path),
119 remove_obsolete=False, install_git_hook=False)
116 return config 120 return config