|
|
99a5464 |
diff --git a/module_build_service/config.py b/module_build_service/config.py
|
|
|
99a5464 |
index e2e2fbe..34f62e3 100644
|
|
|
99a5464 |
--- a/module_build_service/config.py
|
|
|
99a5464 |
+++ b/module_build_service/config.py
|
|
|
99a5464 |
@@ -350,22 +350,23 @@ class Config(object):
|
|
|
99a5464 |
raise Exception("Configuration item's name is not allowed: %s" % key)
|
|
|
99a5464 |
|
|
|
99a5464 |
# Create the empty self._key attribute, so we can assign to it.
|
|
|
99a5464 |
- setattr(self, "_" + key, None)
|
|
|
99a5464 |
-
|
|
|
99a5464 |
- # Create self.key property to access the self._key attribute.
|
|
|
99a5464 |
- # Use the setifok_func if available for the attribute.
|
|
|
99a5464 |
- setifok_func = '_setifok_{}'.format(key)
|
|
|
99a5464 |
- if hasattr(self, setifok_func):
|
|
|
99a5464 |
- setx = lambda self, val: getattr(self, setifok_func)(val)
|
|
|
99a5464 |
- elif value_type == Path:
|
|
|
99a5464 |
- # For paths, expanduser.
|
|
|
99a5464 |
- setx = lambda self, val: setattr(
|
|
|
99a5464 |
- self, "_" + key, os.path.expanduser(val))
|
|
|
99a5464 |
- else:
|
|
|
99a5464 |
- setx = lambda self, val: setattr(self, "_" + key, val)
|
|
|
99a5464 |
- getx = lambda self: getattr(self, "_" + key)
|
|
|
99a5464 |
- delx = lambda self: delattr(self, "_" + key)
|
|
|
99a5464 |
- setattr(Config, key, property(getx, setx, delx))
|
|
|
99a5464 |
+ if not hasattr(self, "_" + key):
|
|
|
99a5464 |
+ setattr(self, "_" + key, None)
|
|
|
99a5464 |
+
|
|
|
99a5464 |
+ # Create self.key property to access the self._key attribute.
|
|
|
99a5464 |
+ # Use the setifok_func if available for the attribute.
|
|
|
99a5464 |
+ setifok_func = '_setifok_{}'.format(key)
|
|
|
99a5464 |
+ if hasattr(self, setifok_func):
|
|
|
99a5464 |
+ setx = lambda self, val: getattr(self, setifok_func)(val)
|
|
|
99a5464 |
+ elif value_type == Path:
|
|
|
99a5464 |
+ # For paths, expanduser.
|
|
|
99a5464 |
+ setx = lambda self, val: setattr(
|
|
|
99a5464 |
+ self, "_" + key, os.path.expanduser(val))
|
|
|
99a5464 |
+ else:
|
|
|
99a5464 |
+ setx = lambda self, val: setattr(self, "_" + key, val)
|
|
|
99a5464 |
+ getx = lambda self: getattr(self, "_" + key)
|
|
|
99a5464 |
+ delx = lambda self: delattr(self, "_" + key)
|
|
|
99a5464 |
+ setattr(Config, key, property(getx, setx, delx))
|
|
|
99a5464 |
|
|
|
99a5464 |
# managed/registered configuration items
|
|
|
99a5464 |
if key in self._defaults:
|