Show More
@@ -59,7 +59,8 b' class TestHomeController(TestController)' | |||
|
59 | 59 | self.log_user() |
|
60 | 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 | 64 | response.mustcontain('style.css?ver={0}'.format(rhodecode_version_hash)) |
|
64 | 65 | response.mustcontain('rhodecode-components.js?ver={0}'.format( |
|
65 | 66 | rhodecode_version_hash)) |
@@ -34,7 +34,7 b' import pyramid.threadlocal' | |||
|
34 | 34 | from paste.auth.basic import AuthBasicAuthenticator |
|
35 | 35 | from paste.httpexceptions import HTTPUnauthorized, HTTPForbidden, get_exception |
|
36 | 36 | from paste.httpheaders import WWW_AUTHENTICATE, AUTHORIZATION |
|
37 |
from pylons import |
|
|
37 | from pylons import tmpl_context as c, request, url | |
|
38 | 38 | from pylons.controllers import WSGIController |
|
39 | 39 | from pylons.controllers.util import redirect |
|
40 | 40 | from pylons.i18n import translation |
@@ -292,7 +292,7 b' class BasicAuth(AuthBasicAuthenticator):' | |||
|
292 | 292 | __call__ = authenticate |
|
293 | 293 | |
|
294 | 294 | |
|
295 | def calculate_version_hash(): | |
|
295 | def calculate_version_hash(config): | |
|
296 | 296 | return md5( |
|
297 | 297 | config.get('beaker.session.secret', '') + |
|
298 | 298 | rhodecode.__version__)[:8] |
@@ -313,13 +313,18 b' def attach_context_attributes(context, r' | |||
|
313 | 313 | Attach variables into template context called `c`, please note that |
|
314 | 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 | 322 | rc_config = SettingsModel().get_all_settings(cache=True) |
|
318 | 323 | |
|
319 | 324 | context.rhodecode_version = rhodecode.__version__ |
|
320 | 325 | context.rhodecode_edition = config.get('rhodecode.edition') |
|
321 | 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 | 329 | # Default language set for the incoming request |
|
325 | 330 | context.language = get_current_lang(request) |
@@ -506,6 +511,7 b' class BaseController(WSGIController):' | |||
|
506 | 511 | __before__ is called before controller methods and after __call__ |
|
507 | 512 | """ |
|
508 | 513 | # on each call propagate settings calls into global settings. |
|
514 | from pylons import config | |
|
509 | 515 | set_rhodecode_config(config) |
|
510 | 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 | 43 | import logging |
|
44 | 44 | |
|
45 | from pylons import config | |
|
46 | from pyramid.threadlocal import get_current_registry | |
|
47 | ||
|
48 | 45 | from rhodecode.model import meta, db |
|
49 | 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 | 65 | def init_model_encryption(migration_models): |
|
66 | from pylons import config | |
|
69 | 67 | migration_models.ENCRYPTION_KEY = get_encryption_key(config) |
|
70 | 68 | db.ENCRYPTION_KEY = get_encryption_key(config) |
|
71 | 69 |
General Comments 0
You need to be logged in to leave comments.
Login now