Setting.format() should effect when you change a setting, mostly for

SensitiveSetting
This commit is contained in:
jesopo 2019-10-07 13:11:58 +01:00
parent b4e65b6a73
commit 5c3510fe7c

View file

@ -114,14 +114,16 @@ class Module(ModuleManager.BaseModule):
def _config(self, export_settings, target, setting, value=None): def _config(self, export_settings, target, setting, value=None):
if not value == None: if not value == None:
setting_object = export_settings[setting]
try: try:
validated_value = export_settings[setting].parse(value) validated_value = setting_object.parse(value)
except utils.SettingParseException as e: except utils.SettingParseException as e:
raise ConfigInvalidValue(str(e)) raise ConfigInvalidValue(str(e))
if not validated_value == None: if not validated_value == None:
target.set_setting(setting, validated_value) target.set_setting(setting, validated_value)
return ConfigResult(ConfigResults.Changed, validated_value) formatted_value = setting_object.format(validated_value)
return ConfigResult(ConfigResults.Changed, formatted_value)
else: else:
raise ConfigInvalidValue() raise ConfigInvalidValue()
else: else: