bacnet/web_settings.py
changeset 2674 a8975ff44cd1
parent 2673 80e7eb44cab4
child 2676 b276d05bdb09
equal deleted inserted replaced
2673:80e7eb44cab4 2674:a8975ff44cd1
   164 
   164 
   165 
   165 
   166 
   166 
   167 def _SetSavedConfiguration(BACnetConfig):
   167 def _SetSavedConfiguration(BACnetConfig):
   168     """ Stores in a file a dictionary containing the BACnet parameter configuration """
   168     """ Stores in a file a dictionary containing the BACnet parameter configuration """
   169     with open(os.path.realpath(_BACnetConfFilename), 'w') as f:
       
   170         json.dump(BACnetConfig, f, sort_keys=True, indent=4)
       
   171     global _SavedConfiguration
   169     global _SavedConfiguration
   172     _SavedConfiguration = BACnetConfig
   170 
       
   171     if BACnetConfig == _DefaultConfiguration :
       
   172         _DelSavedConfiguration()
       
   173         _SavedConfiguration = None
       
   174     else :
       
   175         with open(os.path.realpath(_BACnetConfFilename), 'w') as f:
       
   176             json.dump(BACnetConfig, f, sort_keys=True, indent=4)
       
   177         _SavedConfiguration = BACnetConfig
   173 
   178 
   174 
   179 
   175 def _DelSavedConfiguration():
   180 def _DelSavedConfiguration():
   176     """ Deletes the file cotaining the persistent BACnet configuration """
   181     """ Deletes the file cotaining the persistent BACnet configuration """
   177     if os.path.exists(_BACnetConfFilename):
   182     if os.path.exists(_BACnetConfFilename):