Skip to content

Commit

Permalink
Editor log fix for gnsync
Browse files Browse the repository at this point in the history
  • Loading branch information
varche1 committed Jul 2, 2012
1 parent 4c2deb6 commit 6cc1cfe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion editor.py
Expand Up @@ -25,7 +25,7 @@ def wrapENML(contentHTML):
body += '<en-note>%s</en-note>' % contentHTML
return body

def textToENML(content):
def textToENML(content, raise_ex=False):
"""
Create an ENML format of note.
"""
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion gnsync.py
Expand Up @@ -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))
Expand Down

0 comments on commit 6cc1cfe

Please sign in to comment.