summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Weiser <michael.weiser@gmx.de>2019-04-24 09:56:22 +0000
committerMichael Weiser <michael.weiser@gmx.de>2019-04-25 12:20:20 +0000
commit463a50eb4818e718c227b8da077e351c7f86226d (patch)
tree82ecb8197fd4535916b4decb323fc24c9ae4fcc5
parent211effe9ae3d71665eb7f45e108345e8e21c5dc5 (diff)
Avoid TypeError on ruleset config validation with python3
python3 changes the type of dict().keys() from list to dict_keys which can not be concatenated with a list easily. Options are in-place concatenation using += and explicit cast using list(dict().keys()). We choose the former.
-rw-r--r--peekaboo/ruleset/engine.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/peekaboo/ruleset/engine.py b/peekaboo/ruleset/engine.py
index 90c83f2..96af1c6 100644
--- a/peekaboo/ruleset/engine.py
+++ b/peekaboo/ruleset/engine.py
@@ -99,8 +99,12 @@ class RulesetEngine(object):
# check for unknown config sections by using rule names as rules'
# config section names. Allow all known rules not only the enabled ones
# because some might be temporarily disabled but should be allowed to
- # retain their configuration.
- self.config.check_sections(['rules'] + known_rule_names)
+ # retain their configuration. Use += extension of list to avoid
+ # 'TypeError: can only concatenate list (not "dict_keys") to list' with
+ # python3.
+ known_sections = ['rules']
+ known_sections += known_rule_names
+ self.config.check_sections(known_sections)
# have enabled rules check their configuration
for rule in self.enabled_rules: