Commit ac0efb24 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

cleanup

parent 8dc70e2276e2
......@@ -131,6 +131,7 @@ class EmailITreeAdapter(adapters.ITreeAdapter):
class EmailPartIFTIAdapter(adapters.IFTIndexableAdapter):
"""customize EmailPart IFTI adapter so we don't index pgp signature"""
__select__ = adapters.IFTIndexableAdapter.__select__ & is_instance('EmailPart')
def get_words(self):
......
......@@ -167,6 +167,11 @@ class MBOXImporter(object):
encoding = u'UTF-8'
elif contenttype == 'application/pgp-signature':
encoding = u'ascii'
if isinstance(data, str):
data = unicode(data, encoding)
self.req.set_shared_data('raw_content_%s_%s' %
(emaileid, self._part_index + 1),
str(part.message))
else:
encoding = None
name = part.get_filename()
......@@ -186,12 +191,7 @@ class MBOXImporter(object):
self.execute('SET X attachment Y WHERE X eid %(x)s, Y eid %(y)s',
{'x': emaileid, 'y': epart.eid})
else:
if isinstance(data, str):
data = unicode(data, encoding)
self._part_index += 1
self.req.set_shared_data('raw_content_%s_%s' %
(emaileid, self._part_index),
str(part.message))
epart = self.req.create_entity('EmailPart',
content=data,
content_format=contenttype,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment