From ea99293919265c0f667582ef96b6e85f47a2700c Mon Sep 17 00:00:00 2001 From: Filip Valder Date: Fri, 11 Nov 2016 16:04:57 +0100 Subject: [PATCH] fix: conf variable needn't be registered in DEFAULTS to be able to use _setifok_ handler --- module_build_service/config.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/module_build_service/config.py b/module_build_service/config.py index 33850ce7..17a85f3b 100644 --- a/module_build_service/config.py +++ b/module_build_service/config.py @@ -220,7 +220,7 @@ class Config(object): # registered defaults if key in self._defaults_by_name: - # customized check & set first + # customized check & set if there's a corresponding handler setifok_func = '_setifok_{}'.format(key) if hasattr(self, setifok_func): getattr(self, setifok_func)(value) @@ -241,7 +241,13 @@ class Config(object): raise Exception("Unsupported type %s for configuration item name: %s" % (convert, key)) # passthrough for uncontrolled configuration items else: - setattr(self, key, value) + # customized check & set if there's a corresponding handler + setifok_func = '_setifok_{}'.format(key) + if hasattr(self, setifok_func): + getattr(self, setifok_func)(value) + # otherwise just blindly set value for a key + else: + setattr(self, key, value) return