# HG changeset patch # User Edouard Tisserant # Date 1592224440 -7200 # Node ID a8975ff44cd1f1f5e19c89c99875a0bf33e16da2 # Parent 80e7eb44cab4a99a211c22d9edc0416624f363d2 BACnet: prevent saving configuration that is same as default, delete it if so. diff -r 80e7eb44cab4 -r a8975ff44cd1 bacnet/web_settings.py --- a/bacnet/web_settings.py Mon Jun 15 14:29:41 2020 +0200 +++ b/bacnet/web_settings.py Mon Jun 15 14:34:00 2020 +0200 @@ -166,10 +166,15 @@ def _SetSavedConfiguration(BACnetConfig): """ Stores in a file a dictionary containing the BACnet parameter configuration """ - with open(os.path.realpath(_BACnetConfFilename), 'w') as f: - json.dump(BACnetConfig, f, sort_keys=True, indent=4) global _SavedConfiguration - _SavedConfiguration = BACnetConfig + + if BACnetConfig == _DefaultConfiguration : + _DelSavedConfiguration() + _SavedConfiguration = None + else : + with open(os.path.realpath(_BACnetConfFilename), 'w') as f: + json.dump(BACnetConfig, f, sort_keys=True, indent=4) + _SavedConfiguration = BACnetConfig def _DelSavedConfiguration():