Show More
@@ -76,8 +76,9 b' class RhodecodeCeleryTask(Task):' | |||||
76 |
|
76 | |||
77 | request = get_current_request() |
|
77 | request = get_current_request() | |
78 |
|
78 | |||
79 | # we hook into kwargs since it is the only way to pass our data to the |
|
79 | if request: | |
80 | # celery worker in celery 2.2 |
|
80 | # we hook into kwargs since it is the only way to pass our data to | |
|
81 | # the celery worker in celery 2.2 | |||
81 | kwargs.update({ |
|
82 | kwargs.update({ | |
82 | '_rhodecode_proxy_data': { |
|
83 | '_rhodecode_proxy_data': { | |
83 | 'environ': { |
|
84 | 'environ': { |
@@ -18,15 +18,16 b'' | |||||
18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
18 | # RhodeCode Enterprise Edition, including its added features, Support services, | |
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
20 |
|
20 | |||
|
21 | import rhodecode | |||
|
22 | from pylons import config | |||
|
23 | ||||
21 | from celery.loaders.base import BaseLoader |
|
24 | from celery.loaders.base import BaseLoader | |
22 | from pylons import config |
|
|||
23 |
|
25 | |||
24 | to_pylons = lambda x: x.replace('_', '.').lower() |
|
26 | to_pylons = lambda x: x.replace('_', '.').lower() | |
25 | to_celery = lambda x: x.replace('.', '_').upper() |
|
27 | to_celery = lambda x: x.replace('.', '_').upper() | |
26 |
|
28 | |||
27 | LIST_PARAMS = """CELERY_IMPORTS ADMINS ROUTES""".split() |
|
29 | LIST_PARAMS = """CELERY_IMPORTS ADMINS ROUTES""".split() | |
28 |
|
30 | |||
29 |
|
||||
30 | class PylonsSettingsProxy(object): |
|
31 | class PylonsSettingsProxy(object): | |
31 | """Pylons Settings Proxy |
|
32 | """Pylons Settings Proxy | |
32 |
|
33 | |||
@@ -36,7 +37,7 b' class PylonsSettingsProxy(object):' | |||||
36 | def __getattr__(self, key): |
|
37 | def __getattr__(self, key): | |
37 | pylons_key = to_pylons(key) |
|
38 | pylons_key = to_pylons(key) | |
38 | try: |
|
39 | try: | |
39 |
value = |
|
40 | value = rhodecode.PYRAMID_SETTINGS[pylons_key] | |
40 | if key in LIST_PARAMS:return value.split() |
|
41 | if key in LIST_PARAMS:return value.split() | |
41 | return self.type_converter(value) |
|
42 | return self.type_converter(value) | |
42 | except KeyError: |
|
43 | except KeyError: | |
@@ -56,7 +57,7 b' class PylonsSettingsProxy(object):' | |||||
56 |
|
57 | |||
57 | def __setattr__(self, key, value): |
|
58 | def __setattr__(self, key, value): | |
58 | pylons_key = to_pylons(key) |
|
59 | pylons_key = to_pylons(key) | |
59 |
|
|
60 | rhodecode.PYRAMID_SETTINGS[pylons_key] = value | |
60 |
|
61 | |||
61 | def __setitem__(self, key, value): |
|
62 | def __setitem__(self, key, value): | |
62 | self.__setattr__(key, value) |
|
63 | self.__setattr__(key, value) |
General Comments 0
You need to be logged in to leave comments.
Login now