commit 37a7bef4a8fde168f4882d6274a3c00c5dc96221
parent 14a31805879d6002936c8519e545c599f3b0d1bc
Author: Samuel Walladge <samuel@swalladge.id.au>
Date: Thu, 7 Jul 2016 10:52:08 +0930
add localkey to new notes synced from server
Diffstat:
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/simplenote_cli/notes_db.py b/simplenote_cli/notes_db.py
@@ -55,8 +55,11 @@ def __init__(self, config, log, update_view):
# they're in sync with the disc.
n['savedate'] = now
# set a localkey to each note in memory
+ # Note: 'key' is used only for syncing with server - 'localkey'
+ # is used for everything else in sncli
n['localkey'] = localkey
+ # add the note to our database
self.notes[localkey] = n
# initialise the simplenote instance we're going to use
@@ -479,6 +482,7 @@ def sync_notes(self, server_sync=True, full_sync=True):
k = uret[0].get('key')
n.update(uret[0])
n['syncdate'] = now
+ n['localkey'] = k
self.notes[k] = n
local_updates[k] = True
@@ -527,6 +531,7 @@ def sync_notes(self, server_sync=True, full_sync=True):
self.notes[k].update(gret[0])
local_updates[k] = True
self.notes[k]['syncdate'] = now
+ self.notes[k]['localkey'] = k
self.log('Synced newer note from server (key={0})'.format(k))
else:
@@ -539,6 +544,7 @@ def sync_notes(self, server_sync=True, full_sync=True):
self.notes[k] = gret[0]
local_updates[k] = True
self.notes[k]['syncdate'] = now
+ self.notes[k]['localkey'] = k
self.log('Synced new note from server (key={0})'.format(k))
else:
diff --git a/simplenote_cli/view_note.py b/simplenote_cli/view_note.py
@@ -139,7 +139,7 @@ def get_status_bar(self):
title = utils.get_note_title(self.note)
flags = utils.get_note_flags(self.note)
tags = utils.get_note_tags(self.note)
- version = self.note['version']
+ version = self.note.get('version', 0)
mod_time = time.strftime('Date: %a, %d %b %Y %H:%M:%S', t)