Don't save any App Settings for which value would not change
that lets us avoid writing "redundant" values to the database, whereas in fact the underlying value may be coming from config file
This commit is contained in:
parent
117e52df23
commit
c2968fbe52
|
@ -1,7 +1,7 @@
|
||||||
## -*- coding: utf-8; -*-
|
## -*- coding: utf-8; -*-
|
||||||
<%inherit file="/base.mako" />
|
<%inherit file="/base.mako" />
|
||||||
|
|
||||||
<%def name="title()">${self.app_title()} App Settings</%def>
|
<%def name="title()">App Settings</%def>
|
||||||
|
|
||||||
<%def name="content_title()"></%def>
|
<%def name="content_title()"></%def>
|
||||||
|
|
||||||
|
|
|
@ -180,6 +180,8 @@ class AppSettingsView(View):
|
||||||
return self.rattail_config.get(setting.namespace, setting.name, default='')
|
return self.rattail_config.get(setting.namespace, setting.name, default='')
|
||||||
|
|
||||||
def save_setting_value(self, setting, value):
|
def save_setting_value(self, setting, value):
|
||||||
|
existing = self.get_setting_value(setting)
|
||||||
|
if existing != value:
|
||||||
legacy_name = '{}.{}'.format(setting.namespace, setting.name)
|
legacy_name = '{}.{}'.format(setting.namespace, setting.name)
|
||||||
if setting.data_type is bool:
|
if setting.data_type is bool:
|
||||||
api.save_setting(Session(), legacy_name, 'true' if value else 'false')
|
api.save_setting(Session(), legacy_name, 'true' if value else 'false')
|
||||||
|
|
Loading…
Reference in a new issue