##// END OF EJS Templates
core: removed usage of global pylons config in base lib.
marcink -
r2000:9e69eb38 default
parent child Browse files
Show More
@@ -59,7 +59,8 b' class TestHomeController(TestController)'
59 self.log_user()
59 self.log_user()
60 response = self.app.get(route_path('home'))
60 response = self.app.get(route_path('home'))
61
61
62 rhodecode_version_hash = calculate_version_hash()
62 rhodecode_version_hash = calculate_version_hash(
63 {'beaker.session.secret':'test-rc-uytcxaz'})
63 response.mustcontain('style.css?ver={0}'.format(rhodecode_version_hash))
64 response.mustcontain('style.css?ver={0}'.format(rhodecode_version_hash))
64 response.mustcontain('rhodecode-components.js?ver={0}'.format(
65 response.mustcontain('rhodecode-components.js?ver={0}'.format(
65 rhodecode_version_hash))
66 rhodecode_version_hash))
@@ -34,7 +34,7 b' import pyramid.threadlocal'
34 from paste.auth.basic import AuthBasicAuthenticator
34 from paste.auth.basic import AuthBasicAuthenticator
35 from paste.httpexceptions import HTTPUnauthorized, HTTPForbidden, get_exception
35 from paste.httpexceptions import HTTPUnauthorized, HTTPForbidden, get_exception
36 from paste.httpheaders import WWW_AUTHENTICATE, AUTHORIZATION
36 from paste.httpheaders import WWW_AUTHENTICATE, AUTHORIZATION
37 from pylons import config, tmpl_context as c, request, url
37 from pylons import tmpl_context as c, request, url
38 from pylons.controllers import WSGIController
38 from pylons.controllers import WSGIController
39 from pylons.controllers.util import redirect
39 from pylons.controllers.util import redirect
40 from pylons.i18n import translation
40 from pylons.i18n import translation
@@ -292,7 +292,7 b' class BasicAuth(AuthBasicAuthenticator):'
292 __call__ = authenticate
292 __call__ = authenticate
293
293
294
294
295 def calculate_version_hash():
295 def calculate_version_hash(config):
296 return md5(
296 return md5(
297 config.get('beaker.session.secret', '') +
297 config.get('beaker.session.secret', '') +
298 rhodecode.__version__)[:8]
298 rhodecode.__version__)[:8]
@@ -313,13 +313,18 b' def attach_context_attributes(context, r'
313 Attach variables into template context called `c`, please note that
313 Attach variables into template context called `c`, please note that
314 request could be pylons or pyramid request in here.
314 request could be pylons or pyramid request in here.
315 """
315 """
316 # NOTE(marcink): remove check after pyramid migration
317 if hasattr(request, 'registry'):
318 config = request.registry.settings
319 else:
320 from pylons import config
316
321
317 rc_config = SettingsModel().get_all_settings(cache=True)
322 rc_config = SettingsModel().get_all_settings(cache=True)
318
323
319 context.rhodecode_version = rhodecode.__version__
324 context.rhodecode_version = rhodecode.__version__
320 context.rhodecode_edition = config.get('rhodecode.edition')
325 context.rhodecode_edition = config.get('rhodecode.edition')
321 # unique secret + version does not leak the version but keep consistency
326 # unique secret + version does not leak the version but keep consistency
322 context.rhodecode_version_hash = calculate_version_hash()
327 context.rhodecode_version_hash = calculate_version_hash(config)
323
328
324 # Default language set for the incoming request
329 # Default language set for the incoming request
325 context.language = get_current_lang(request)
330 context.language = get_current_lang(request)
@@ -506,6 +511,7 b' class BaseController(WSGIController):'
506 __before__ is called before controller methods and after __call__
511 __before__ is called before controller methods and after __call__
507 """
512 """
508 # on each call propagate settings calls into global settings.
513 # on each call propagate settings calls into global settings.
514 from pylons import config
509 set_rhodecode_config(config)
515 set_rhodecode_config(config)
510 attach_context_attributes(c, request, self._rhodecode_user.user_id)
516 attach_context_attributes(c, request, self._rhodecode_user.user_id)
511
517
@@ -42,9 +42,6 b" The application's model objects"
42
42
43 import logging
43 import logging
44
44
45 from pylons import config
46 from pyramid.threadlocal import get_current_registry
47
48 from rhodecode.model import meta, db
45 from rhodecode.model import meta, db
49 from rhodecode.lib.utils2 import obfuscate_url_pw, get_encryption_key
46 from rhodecode.lib.utils2 import obfuscate_url_pw, get_encryption_key
50
47
@@ -66,6 +63,7 b' def init_model(engine, encryption_key=No'
66
63
67
64
68 def init_model_encryption(migration_models):
65 def init_model_encryption(migration_models):
66 from pylons import config
69 migration_models.ENCRYPTION_KEY = get_encryption_key(config)
67 migration_models.ENCRYPTION_KEY = get_encryption_key(config)
70 db.ENCRYPTION_KEY = get_encryption_key(config)
68 db.ENCRYPTION_KEY = get_encryption_key(config)
71
69
General Comments 0
You need to be logged in to leave comments. Login now