
commit 59172be86b9ba4a22d6a9f7faf02bf51e69b0a2e Author: Damian Johnson <atagar@torproject.org> Date: Sat Feb 6 14:28:51 2016 -0800 Don't add 'settings_loaded' to configs Our @uses_settings annotation stored and loaded a 'settings_loaded' value to track if it had already lazy loaded content. This is inappropriate - we shouldn't muck with the content of our user's configs. --- stem/util/conf.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/stem/util/conf.py b/stem/util/conf.py index a2763eb..dff5ace 100644 --- a/stem/util/conf.py +++ b/stem/util/conf.py @@ -275,15 +275,15 @@ def uses_settings(handle, path, lazy_load = True): config = get_config(handle) - if not lazy_load and not config.get('settings_loaded', False): + if not lazy_load and not config._settings_loaded: config.load(path) - config.set('settings_loaded', 'true') + config._settings_loaded = True def decorator(func): def wrapped(*args, **kwargs): - if lazy_load and not config.get('settings_loaded', False): + if lazy_load and not config._settings_loaded: config.load(path) - config.set('settings_loaded', 'true') + config._settings_loaded = True if 'config' in inspect.getargspec(func).args: return func(*args, config = config, **kwargs) @@ -460,6 +460,9 @@ class Config(object): # keys that have been requested (used to provide unused config contents) self._requested_keys = set() + # flag to support lazy loading in uses_settings() + self._settings_loaded = False + def load(self, path = None, commenting = True): """ Reads in the contents of the given path, adding its configuration values