From bc6cbff8827b8f4252b54d3856eacd9cc799d84f Mon Sep 17 00:00:00 2001 From: atomicules Date: Sun, 30 Sep 2018 11:41:37 +0100 Subject: [PATCH] Quick Simperium fixes I am pushed for time. As with the simplenote.py changes for Simperium I'm just trying to get something out that _works_ and then I can work on making the code better. It'd be easy if Python 2 just went away though. - Use simplenote.py v2.0.0 (Simperium API) - Make one test change; Haven't really looked into why it's now True instead of 1. I.e. don't know if that's a Simperium change or something I've not got quite right in the simplenote.py changes - Handle the one Unicode / UTF-8 breakage I've found so far. --- autoload/SimplenoteUtilities.py | 5 ++++- autoload/simplenote.py | 2 +- tests/simplenote.vader | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/autoload/SimplenoteUtilities.py b/autoload/SimplenoteUtilities.py index 340f478..d2c370f 100644 --- a/autoload/SimplenoteUtilities.py +++ b/autoload/SimplenoteUtilities.py @@ -705,7 +705,10 @@ def list_note_index_in_scratch_buffer(self, since=None, tags=[]): def get_note_title(note): """ get title of note """ note_lines = note["content"].split("\n") - return str(note_lines[0] if len(note_lines) > 0 else note["key"]) + try: + return str(note_lines[0] if len(note_lines) > 0 else note["key"]) + except UnicodeEncodeError: + return unicode(note_lines[0] if len(note_lines) > 0 else note["key"]) class NoteFetcher(Thread): diff --git a/autoload/simplenote.py b/autoload/simplenote.py index 3521612..ceeb4b9 160000 --- a/autoload/simplenote.py +++ b/autoload/simplenote.py @@ -1 +1 @@ -Subproject commit 3521612b3777891bd842e7b56b86d847440197e4 +Subproject commit ceeb4b9ec847685991020aa49883c846274f2bdd diff --git a/tests/simplenote.vader b/tests/simplenote.vader index db5c8a8..cf0f9a1 100644 --- a/tests/simplenote.vader +++ b/tests/simplenote.vader @@ -69,7 +69,7 @@ Execute python: Expect: A third test note - 1 + True # Deletes a note