BACnet: prevent saving configuration that is same as default, delete it if so.
--- 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():