From b16bae353e40fa05b4993ef68232a9df83db370e Mon Sep 17 00:00:00 2001 From: kaeff Date: Mon, 17 Aug 2015 15:56:50 +0200 Subject: Read encoding from attachment info instead of headers Clean up by removing now unused headers from attachment info, and add a unit test for attachment rendering --- service/pixelated/adapter/mailstore/leap_mailstore.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'service/pixelated/adapter/mailstore/leap_mailstore.py') diff --git a/service/pixelated/adapter/mailstore/leap_mailstore.py b/service/pixelated/adapter/mailstore/leap_mailstore.py index a8fa6d13..a9fb5ba1 100644 --- a/service/pixelated/adapter/mailstore/leap_mailstore.py +++ b/service/pixelated/adapter/mailstore/leap_mailstore.py @@ -26,11 +26,10 @@ from pixelated.adapter.model.mail import Mail, InputMail class AttachmentInfo(object): - def __init__(self, ident, name, encoding, headers): + def __init__(self, ident, name, encoding): self.ident = ident self.name = name self.encoding = encoding - self.headers = headers class LeapMail(Mail): @@ -99,7 +98,7 @@ class LeapMail(Mail): 'textPlainBody': self._body, 'replying': self._replying_dict(), 'mailbox': self._mailbox_name.lower(), - 'attachments': [{'ident': attachment.ident, 'name': attachment.name, 'encoding': attachment.encoding, 'headers': attachment.headers} for attachment in self._attachments] + 'attachments': [{'ident': attachment.ident, 'name': attachment.name, 'encoding': attachment.encoding} for attachment in self._attachments] } def _replying_dict(self): @@ -311,7 +310,7 @@ class LeapMailStore(MailStore): if 'attachment' in disposition: filename = _extract_filename(disposition) encoding = headers['Content-Transfer-Encoding'] - result.append(AttachmentInfo(phash, filename, encoding, headers)) + result.append(AttachmentInfo(phash, filename, encoding)) return result -- cgit v1.2.3