From 6cc1cfe3683e33e39bbb21803d172b5fc49f4759 Mon Sep 17 00:00:00 2001 From: Ivan Gureev Date: Mon, 2 Jul 2012 11:12:52 +0400 Subject: [PATCH] Editor log fix for gnsync --- editor.py | 5 ++++- gnsync.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/editor.py b/editor.py index 25d1dde..b31653c 100755 --- a/editor.py +++ b/editor.py @@ -25,7 +25,7 @@ def wrapENML(contentHTML): body += '%s' % contentHTML return body -def textToENML(content): +def textToENML(content, raise_ex=False): """ Create an ENML format of note. """ @@ -40,6 +40,9 @@ def textToENML(content): contentHTML = re.sub(r'\n', r'', contentHTML) return wrapENML(contentHTML) except: + if raise_ex: + raise Exception("Error while parsing text to html. Content must be an UTF-8 encode.") + logging.error("Error while parsing text to html. Content must be an UTF-8 encode.") out.failureMessage("Error while parsing text to html. Content must be an UTF-8 encode.") return tools.exit() diff --git a/gnsync.py b/gnsync.py index b871fa9..30ee773 100755 --- a/gnsync.py +++ b/gnsync.py @@ -177,7 +177,7 @@ def _get_file_content(self, path): Get file content. """ content = open(path, "r").read() - content = editor.textToENML(content) + content = editor.textToENML(content=content, raise_ex=True) if content is None: logger.warning("File {0}. Content must be an UTF-8 encode.".format(path))