Fixed ID,last URI, or last connection date not being updated when connnecting to target.
authorEdouard Tisserant
Mon, 26 Nov 2018 15:12:18 +0100
changeset 2460 89abeece2c71
parent 2459 21164625b393
child 2461 9624575a9cac
Fixed ID,last URI, or last connection date not being updated when connnecting to target.
PSKManagement.py
--- a/PSKManagement.py	Fri Nov 23 12:13:24 2018 +0100
+++ b/PSKManagement.py	Mon Nov 26 15:12:18 2018 +0100
@@ -81,11 +81,20 @@
     # here we directly use _LoadData, avoiding filtering that could be long
     data = _LoadData(project_path)
     idata = _dataByID(data)
-    dataForID = idata.get(ID, _default(ID)) if data else _default(ID)
+    dataForID = idata.get(ID, None) if data else None
+
+    _is_new_ID = dataForID is None
+    if _is_new_ID:
+       dataForID = _default(ID)
+
     dataForID[COL_URI] = URI
     # FIXME : could store time instead os a string and use DVC model's cmp 
     # then date display could be smarter, etc - sortable sting hack for now
     dataForID[COL_LAST] = time.strftime('%y/%M/%d-%H:%M:%S')
+
+    if _is_new_ID:
+        data.append(dataForID)
+
     SaveData(project_path, data)
 
 def ExportIDs(project_path, export_zip):