Skip to content
Myr

Update config.py

Before adoption: this commit came in with the history the project adopted, so no landing records it.

I want to load all of my `CELERY_` options from the config and leave `CELERY_` on there.

authored by Bryan Stitt · committed by defuz · parent a8c36fb · Browse files · 1 file+5 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−2 removed

  • other:+5 added−2 removed

1 file+5 added−2 removed

modified:flask/config.py+5 added-2 removed
211 unmodified lines
212 if key.isupper():213 self[key] = value214 return True215216 def get_namespace(self, namespace, lowercase=True):216 def get_namespace(self, namespace, lowercase=True, trim_namespace=True):217 """Returns a dictionary containing a subset of configuration options218 that match the specified namespace/prefix. Example usage::219220 app.config['IMAGE_STORE_TYPE'] = 'fs'
14 unmodified lines
235236 :param namespace: a configuration namespace237 :param lowercase: a flag indicating if the keys of the resulting238 dictionary should be lowercase239 :param trim_namespace: a flag indicating if the keys of the resulting240 dictionary should not include the namespace241242 .. versionadded:: 1.0243 """244 rv = {}245 for k, v in iteritems(self):246 if not k.startswith(namespace):247 continue248 if trim_namespace:246 key = k[len(namespace):]249 key = k[len(namespace):]250 if lowercase:251 key = key.lower()252 rv[key] = v253 return rv
3 unmodified lines