Don't use empty string as default setting value
should just fall back to None as per usual
This commit is contained in:
parent
c2968fbe52
commit
87ba8026e5
|
@ -177,16 +177,17 @@ class AppSettingsView(View):
|
|||
def get_setting_value(self, setting):
|
||||
if setting.data_type is bool:
|
||||
return self.rattail_config.getbool(setting.namespace, setting.name)
|
||||
return self.rattail_config.get(setting.namespace, setting.name, default='')
|
||||
return self.rattail_config.get(setting.namespace, setting.name)
|
||||
|
||||
def save_setting_value(self, setting, value):
|
||||
existing = self.get_setting_value(setting)
|
||||
if existing != value:
|
||||
legacy_name = '{}.{}'.format(setting.namespace, setting.name)
|
||||
if setting.data_type is bool:
|
||||
api.save_setting(Session(), legacy_name, 'true' if value else 'false')
|
||||
value = 'true' if value else 'false'
|
||||
else:
|
||||
api.save_setting(Session(), legacy_name, six.text_type(value))
|
||||
value = six.text_type(value)
|
||||
api.save_setting(Session(), legacy_name, value)
|
||||
|
||||
@classmethod
|
||||
def defaults(cls, config):
|
||||
|
|
Loading…
Reference in a new issue