summaryrefslogtreecommitdiff
path: root/service/pixelated/adapter
diff options
context:
space:
mode:
Diffstat (limited to 'service/pixelated/adapter')
-rw-r--r--service/pixelated/adapter/mailstore/leap_mailstore.py4
-rw-r--r--service/pixelated/adapter/search/__init__.py4
2 files changed, 6 insertions, 2 deletions
diff --git a/service/pixelated/adapter/mailstore/leap_mailstore.py b/service/pixelated/adapter/mailstore/leap_mailstore.py
index 90035d20..14b0e417 100644
--- a/service/pixelated/adapter/mailstore/leap_mailstore.py
+++ b/service/pixelated/adapter/mailstore/leap_mailstore.py
@@ -27,6 +27,8 @@ from pixelated.adapter.mailstore.mailstore import MailStore, underscore_uuid
from leap.mail.mail import Message
from pixelated.adapter.model.mail import Mail, InputMail
+from pixelated.utils import to_unicode
+
class AttachmentInfo(object):
def __init__(self, ident, name, encoding):
@@ -41,7 +43,7 @@ class LeapMail(Mail):
self._mail_id = mail_id
self._mailbox_name = mailbox_name
self._headers = headers if headers is not None else {}
- self._body = body
+ self._body = to_unicode(body)
self.tags = set(tags) # TODO test that asserts copy
self._flags = set(flags) # TODO test that asserts copy
self._attachments = attachments
diff --git a/service/pixelated/adapter/search/__init__.py b/service/pixelated/adapter/search/__init__.py
index 065dd5e5..8d0b1f4e 100644
--- a/service/pixelated/adapter/search/__init__.py
+++ b/service/pixelated/adapter/search/__init__.py
@@ -31,6 +31,8 @@ from whoosh import sorting
from pixelated.support.functional import unique
import traceback
+from pixelated.utils import to_unicode
+
class SearchEngine(object):
DEFAULT_INDEX_HOME = os.path.join(os.environ['HOME'], '.leap')
@@ -132,7 +134,7 @@ class SearchEngine(object):
'cc': self._format_recipient(header, 'cc'),
'bcc': self._format_recipient(header, 'bcc'),
'tag': u','.join(unique(tags)),
- 'body': unicode(mdict['textPlainBody'] if 'textPlainBody' in mdict else mdict['body']),
+ 'body': to_unicode(mdict.get('textPlainBody', mdict.get('body', ''))),
'ident': unicode(mdict['ident']),
'flags': unicode(','.join(unique(mail.flags))),
'raw': unicode(mail.raw)