79 f.write(ID+":"+secret) |
79 f.write(ID+":"+secret) |
80 |
80 |
81 # here we directly use _LoadData, avoiding filtering that could be long |
81 # here we directly use _LoadData, avoiding filtering that could be long |
82 data = _LoadData(project_path) |
82 data = _LoadData(project_path) |
83 idata = _dataByID(data) |
83 idata = _dataByID(data) |
84 dataForID = idata.get(ID, _default(ID)) if data else _default(ID) |
84 dataForID = idata.get(ID, None) if data else None |
|
85 |
|
86 _is_new_ID = dataForID is None |
|
87 if _is_new_ID: |
|
88 dataForID = _default(ID) |
|
89 |
85 dataForID[COL_URI] = URI |
90 dataForID[COL_URI] = URI |
86 # FIXME : could store time instead os a string and use DVC model's cmp |
91 # FIXME : could store time instead os a string and use DVC model's cmp |
87 # then date display could be smarter, etc - sortable sting hack for now |
92 # then date display could be smarter, etc - sortable sting hack for now |
88 dataForID[COL_LAST] = time.strftime('%y/%M/%d-%H:%M:%S') |
93 dataForID[COL_LAST] = time.strftime('%y/%M/%d-%H:%M:%S') |
|
94 |
|
95 if _is_new_ID: |
|
96 data.append(dataForID) |
|
97 |
89 SaveData(project_path, data) |
98 SaveData(project_path, data) |
90 |
99 |
91 def ExportIDs(project_path, export_zip): |
100 def ExportIDs(project_path, export_zip): |
92 with ZipFile(export_zip, 'w') as zf: |
101 with ZipFile(export_zip, 'w') as zf: |
93 path = _pskpath(project_path) |
102 path = _pskpath(project_path) |