modbus/web_settings.py
branchsvghmi
changeset 3054 b4a84892e369
parent 2993 b76f303ffce6
child 3055 6dd617cc9c05
equal deleted inserted replaced
3053:bff50b7e50ee 3054:b4a84892e369
   226 
   226 
   227         # Add the addr_type and node_type to the data that will be saved to file
   227         # Add the addr_type and node_type to the data that will be saved to file
   228         # This allows us to confirm the saved data contains the correct addr_type
   228         # This allows us to confirm the saved data contains the correct addr_type
   229         # when loading from file
   229         # when loading from file
   230         save_info = {}
   230         save_info = {}
   231         save_info["addr_type"] = ["addr_type"]
   231         save_info["addr_type"] = WebNode_entry["addr_type"]
   232         save_info["node_type"] = WebNode_entry["node_type"]
   232         save_info["node_type"] = WebNode_entry["node_type"]
   233         save_info["config"   ] = newConfig
   233         save_info["config"   ] = newConfig
   234         
   234         
   235         filename = WebNode_entry["filename"]
   235         filename = WebNode_entry["filename"]
   236 
   236 
   260     addr_type of the WebNode_id), then return None
   260     addr_type of the WebNode_id), then return None
   261     """
   261     """
   262     filename = _WebNodeList[WebNode_id]["filename"]
   262     filename = _WebNodeList[WebNode_id]["filename"]
   263     try:
   263     try:
   264         #if os.path.isfile(filename):
   264         #if os.path.isfile(filename):
   265         save_info = json.load(open(filename))
   265         save_info = json.load(open(os.path.realpath(filename)))
   266     except Exception:    
   266     except Exception:    
   267         return None
   267         return None
   268 
   268 
   269     if save_info["addr_type"] != _WebNodeList[WebNode_id]["addr_type"]:
   269     if save_info["addr_type"] != _WebNodeList[WebNode_id]["addr_type"]:
   270         return None
   270         return None