##// END OF EJS Templates
celery: make celery load config from pyramid_app if available...
dan -
r654:f6e3b63a default
parent child Browse files
Show More
@@ -18,8 +18,8 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 pylons
21 import rhodecode
22 import rhodecode
22 from pylons import config
23
23
24 from celery.loaders.base import BaseLoader
24 from celery.loaders.base import BaseLoader
25
25
@@ -36,9 +36,11 b' class PylonsSettingsProxy(object):'
36 """
36 """
37 def __getattr__(self, key):
37 def __getattr__(self, key):
38 pylons_key = to_pylons(key)
38 pylons_key = to_pylons(key)
39 proxy_config = rhodecode.PYRAMID_SETTINGS or pylons.config
39 try:
40 try:
40 value = rhodecode.PYRAMID_SETTINGS[pylons_key]
41 value = proxy_config[pylons_key]
41 if key in LIST_PARAMS:return value.split()
42 if key in LIST_PARAMS:
43 return value.split()
42 return self.type_converter(value)
44 return self.type_converter(value)
43 except KeyError:
45 except KeyError:
44 raise AttributeError(pylons_key)
46 raise AttributeError(pylons_key)
@@ -57,7 +59,8 b' class PylonsSettingsProxy(object):'
57
59
58 def __setattr__(self, key, value):
60 def __setattr__(self, key, value):
59 pylons_key = to_pylons(key)
61 pylons_key = to_pylons(key)
60 rhodecode.PYRAMID_SETTINGS[pylons_key] = value
62 proxy_config = rhodecode.PYRAMID_SETTINGS or pylons.config
63 proxy_config[pylons_key] = value
61
64
62 def __setitem__(self, key, value):
65 def __setitem__(self, key, value):
63 self.__setattr__(key, value)
66 self.__setattr__(key, value)
@@ -90,4 +93,5 b' class PylonsLoader(BaseLoader):'
90 from rhodecode.config.middleware import make_pyramid_app
93 from rhodecode.config.middleware import make_pyramid_app
91
94
92 # adding to self to keep a reference around
95 # adding to self to keep a reference around
93 self.pyramid_app = make_pyramid_app(config, **config['app_conf'])
96 self.pyramid_app = make_pyramid_app(
97 pylons.config, **pylons.config['app_conf'])
General Comments 0
You need to be logged in to leave comments. Login now