commit 5f29c1eecee39d2b429a57babd50e959c3ce11cf Author: Damian Johnson atagar@torproject.org Date: Wed Jan 2 19:20:59 2013 -0800
Fixing broken config handler
Most modules fetch a select set of config options. The torConfig however queries quite a bit more based on a prefix. This was broken, causing us to both not pick a lot of content for the config panel and spew out lots of unused configuration notices. --- src/util/torConfig.py | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/util/torConfig.py b/src/util/torConfig.py index 9abd9fa..c9f32f6 100644 --- a/src/util/torConfig.py +++ b/src/util/torConfig.py @@ -13,16 +13,11 @@ from util import sysTools, torTools, uiTools
from stem.util import conf, enum, log
+ def conf_handler(key, value): if key == "config.important": # stores lowercase entries to drop case sensitivity return [entry.lower() for entry in value] - elif key.startswith("config.summary."): - # we'll look for summary keys with a lowercase config name - CONFIG[key.lower()] = value - elif key.startswith("torrc.label.") and value: - # all the torrc.label.* values are comma separated lists - return [entry.strip() for entry in value[0].split(",")]
CONFIG = conf.config_dict("arm", { "features.torrc.validate": True, @@ -40,6 +35,18 @@ CONFIG = conf.config_dict("arm", { "torrc.label.time.week": [], }, conf_handler)
+def general_conf_handler(config, key): + value = config.get(key) + + if key.startswith("config.summary."): + # we'll look for summary keys with a lowercase config name + CONFIG[key.lower()] = value + elif key.startswith("torrc.label.") and value: + # all the torrc.label.* values are comma separated lists + return [entry.strip() for entry in value[0].split(",")] + +conf.get_config("arm").add_listener(general_conf_handler, backfill = True) + # enums and values for numeric torrc entries ValueType = enum.Enum("UNRECOGNIZED", "SIZE", "TIME") SIZE_MULT = {"b": 1, "kb": 1024, "mb": 1048576, "gb": 1073741824, "tb": 1099511627776}
tor-commits@lists.torproject.org