Show More
@@ -76,25 +76,26 b' class RhodecodeCeleryTask(Task):' | |||
|
76 | 76 | |
|
77 | 77 | request = get_current_request() |
|
78 | 78 | |
|
79 | # we hook into kwargs since it is the only way to pass our data to the | |
|
80 | # celery worker in celery 2.2 | |
|
81 | kwargs.update({ | |
|
82 | '_rhodecode_proxy_data': { | |
|
83 |
' |
|
|
84 |
' |
|
|
85 |
' |
|
|
86 |
' |
|
|
87 |
request.environ |
|
|
88 |
|
|
|
89 |
'SERVER_ |
|
|
90 |
' |
|
|
91 | }, | |
|
92 |
|
|
|
93 |
' |
|
|
94 |
' |
|
|
95 | }, | |
|
96 | } | |
|
97 |
} |
|
|
79 | if request: | |
|
80 | # we hook into kwargs since it is the only way to pass our data to | |
|
81 | # the celery worker in celery 2.2 | |
|
82 | kwargs.update({ | |
|
83 | '_rhodecode_proxy_data': { | |
|
84 | 'environ': { | |
|
85 | 'PATH_INFO': request.environ['PATH_INFO'], | |
|
86 | 'SCRIPT_NAME': request.environ['SCRIPT_NAME'], | |
|
87 | 'HTTP_HOST': request.environ.get('HTTP_HOST', | |
|
88 | request.environ['SERVER_NAME']), | |
|
89 | 'SERVER_NAME': request.environ['SERVER_NAME'], | |
|
90 | 'SERVER_PORT': request.environ['SERVER_PORT'], | |
|
91 | 'wsgi.url_scheme': request.environ['wsgi.url_scheme'], | |
|
92 | }, | |
|
93 | 'auth_user': { | |
|
94 | 'ip_addr': request.user.ip_addr, | |
|
95 | 'user_id': request.user.user_id | |
|
96 | }, | |
|
97 | } | |
|
98 | }) | |
|
98 | 99 | return super(RhodecodeCeleryTask, self).apply_async( |
|
99 | 100 | args, kwargs, task_id, producer, link, link_error, **options) |
|
100 | 101 |
@@ -18,15 +18,16 b'' | |||
|
18 | 18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
19 | 19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
20 | 20 | |
|
21 | import rhodecode | |
|
22 | from pylons import config | |
|
23 | ||
|
21 | 24 | from celery.loaders.base import BaseLoader |
|
22 | from pylons import config | |
|
23 | 25 | |
|
24 | 26 | to_pylons = lambda x: x.replace('_', '.').lower() |
|
25 | 27 | to_celery = lambda x: x.replace('.', '_').upper() |
|
26 | 28 | |
|
27 | 29 | LIST_PARAMS = """CELERY_IMPORTS ADMINS ROUTES""".split() |
|
28 | 30 | |
|
29 | ||
|
30 | 31 | class PylonsSettingsProxy(object): |
|
31 | 32 | """Pylons Settings Proxy |
|
32 | 33 | |
@@ -36,7 +37,7 b' class PylonsSettingsProxy(object):' | |||
|
36 | 37 | def __getattr__(self, key): |
|
37 | 38 | pylons_key = to_pylons(key) |
|
38 | 39 | try: |
|
39 |
value = |
|
|
40 | value = rhodecode.PYRAMID_SETTINGS[pylons_key] | |
|
40 | 41 | if key in LIST_PARAMS:return value.split() |
|
41 | 42 | return self.type_converter(value) |
|
42 | 43 | except KeyError: |
@@ -56,7 +57,7 b' class PylonsSettingsProxy(object):' | |||
|
56 | 57 | |
|
57 | 58 | def __setattr__(self, key, value): |
|
58 | 59 | pylons_key = to_pylons(key) |
|
59 |
|
|
|
60 | rhodecode.PYRAMID_SETTINGS[pylons_key] = value | |
|
60 | 61 | |
|
61 | 62 | def __setitem__(self, key, value): |
|
62 | 63 | self.__setattr__(key, value) |
General Comments 0
You need to be logged in to leave comments.
Login now