summaryrefslogtreecommitdiff
path: root/service/pixelated/adapter
diff options
context:
space:
mode:
authorJefferson Stachelski <jstachel@thoughtworks.com>2016-01-18 18:20:48 -0200
committerJefferson Stachelski <jstachel@thoughtworks.com>2016-01-20 11:18:32 -0200
commite7a093f55df2a5b5d1085618f66c807bc85b7b03 (patch)
tree654e0a4ecbe60848b0ba2b1b5e2e9f2bc8a648c9 /service/pixelated/adapter
parent5e17652b6fa0d6412a097c0ec63fa224f3d606e7 (diff)
Some work around that fixed jeffhsta wazokazi account
Diffstat (limited to 'service/pixelated/adapter')
-rw-r--r--service/pixelated/adapter/mailstore/body_parser.py3
-rw-r--r--service/pixelated/adapter/search/__init__.py5
2 files changed, 4 insertions, 4 deletions
diff --git a/service/pixelated/adapter/mailstore/body_parser.py b/service/pixelated/adapter/mailstore/body_parser.py
index a6017833..7fb084af 100644
--- a/service/pixelated/adapter/mailstore/body_parser.py
+++ b/service/pixelated/adapter/mailstore/body_parser.py
@@ -40,8 +40,7 @@ class BodyParser(object):
text = self._serialize_for_parser(charset)
decoded_body = self._parse_and_decode(text)
-
- return unicode(decoded_body, encoding=charset)
+ return unicode(decoded_body, charset, errors='replace')
def _parse_and_decode(self, text):
parsed_body = Parser().parsestr(text)
diff --git a/service/pixelated/adapter/search/__init__.py b/service/pixelated/adapter/search/__init__.py
index dbd4d288..35087101 100644
--- a/service/pixelated/adapter/search/__init__.py
+++ b/service/pixelated/adapter/search/__init__.py
@@ -115,8 +115,9 @@ class SearchEngine(object):
return FileIndex.create(storage, self._mail_schema(), indexname='mails')
def index_mail(self, mail):
- with AsyncWriter(self._index) as writer:
- self._index_mail(writer, mail)
+ if mail is not None:
+ with AsyncWriter(self._index) as writer:
+ self._index_mail(writer, mail)
def _index_mail(self, writer, mail):
mdict = mail.as_dict()