##// END OF EJS Templates
db: Move db setup code to seperate function.
johbo -
r121:6b332d07 default
parent child Browse files
Show More
@@ -174,3 +174,19 b' def _use_direct_hook_calls(config):'
174 def _get_vcs_hooks_protocol(config):
174 def _get_vcs_hooks_protocol(config):
175 protocol = config.get('vcs.hooks.protocol', 'pyro4').lower()
175 protocol = config.get('vcs.hooks.protocol', 'pyro4').lower()
176 return protocol
176 return protocol
177
178
179 def load_pyramid_environment(global_config, settings):
180 # Some parts of the code expect a merge of global and app settings.
181 settings_merged = global_config.copy()
182 settings_merged.update(settings)
183
184 # If this is a test run we prepare the test environment like
185 # creating a test database, test search index and test repositories.
186 # This has to be done before the database connection is initialized.
187 if settings['is_test']:
188 rhodecode.is_test = True
189 utils.initialize_test_environment(settings_merged)
190
191 # Initialize the database connection.
192 utils.initialize_database(settings_merged)
@@ -36,8 +36,9 b' from routes.middleware import RoutesMidd'
36 import routes.util
36 import routes.util
37
37
38 import rhodecode
38 import rhodecode
39 from rhodecode.config import patches, utils
39 from rhodecode.config import patches
40 from rhodecode.config.environment import load_environment
40 from rhodecode.config.environment import (
41 load_environment, load_pyramid_environment)
41 from rhodecode.lib.middleware import csrf
42 from rhodecode.lib.middleware import csrf
42 from rhodecode.lib.middleware.appenlight import wrap_in_appenlight_if_enabled
43 from rhodecode.lib.middleware.appenlight import wrap_in_appenlight_if_enabled
43 from rhodecode.lib.middleware.disable_vcs import DisableVCSPagesWrapper
44 from rhodecode.lib.middleware.disable_vcs import DisableVCSPagesWrapper
@@ -157,23 +158,11 b' def make_pyramid_app(global_config, **se'
157 # behavior in the old application.
158 # behavior in the old application.
158 settings_pylons = settings.copy()
159 settings_pylons = settings.copy()
159
160
160 # Some parts of the code expect a merge of global and app settings.
161 settings_merged = global_config.copy()
162 settings_merged.update(settings)
163
164 sanitize_settings_and_apply_defaults(settings)
161 sanitize_settings_and_apply_defaults(settings)
165 config = Configurator(settings=settings)
162 config = Configurator(settings=settings)
166 add_pylons_compat_data(config.registry, global_config, settings_pylons)
163 add_pylons_compat_data(config.registry, global_config, settings_pylons)
167
164
168 # If this is a test run we prepare the test environment like
165 load_pyramid_environment(global_config, settings)
169 # creating a test database, test search index and test repositories.
170 # This has to be done before the database connection is initialized.
171 if settings['is_test']:
172 rhodecode.is_test = True
173 utils.initialize_test_environment(settings_merged)
174
175 # Initialize the database connection.
176 utils.initialize_database(settings_merged)
177
166
178 includeme(config)
167 includeme(config)
179 includeme_last(config)
168 includeme_last(config)
General Comments 0
You need to be logged in to leave comments. Login now