From dde0dc6bb735cebe946c6fd8c5d7c8cfd6028cc8 Mon Sep 17 00:00:00 2001 From: Alexandre Pretto Nunes Date: Thu, 14 Aug 2014 15:16:56 -0300 Subject: Enable fake server to correctly serve html emails --- py-fake-service/app/adapter/mail_service.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'py-fake-service/app/adapter/mail_service.py') diff --git a/py-fake-service/app/adapter/mail_service.py b/py-fake-service/app/adapter/mail_service.py index 7c2570f9..41195c0a 100644 --- a/py-fake-service/app/adapter/mail_service.py +++ b/py-fake-service/app/adapter/mail_service.py @@ -16,12 +16,10 @@ class MailService: def load_mailset(self): mbox_filenames = [filename for filename in os.listdir(self.MAILSET_PATH) if filename.startswith('mbox')] - boxes = (mailbox.mbox(os.path.join(self.MAILSET_PATH, mbox)) for mbox in mbox_filenames) + boxes = (mailbox.mbox(os.path.join(self.MAILSET_PATH, mbox)) for mbox in mbox_filenames) for box in boxes: message = box.popitem()[1] - if message.is_multipart(): - continue self.mailset.add(message) self.tagsset.add(message) self.contacts.add(message) @@ -49,13 +47,13 @@ class MailService: def update_tags_for(self, mail_id, new_tags): mail = self.mail(mail_id) - + new_tags_set = set(new_tags) old_tags_set = set(mail.tags) - increment_set = new_tags_set - old_tags_set + increment_set = new_tags_set - old_tags_set decrement_set = old_tags_set - new_tags_set - + map(lambda x : self.tagsset.increment_tag_total_count(x), increment_set) map(lambda x : self.tagsset.decrement_tag_total_count(x), decrement_set) @@ -71,8 +69,8 @@ class MailService: def save_draft(self, mail): mail = self.mailset.add_draft(Mail.from_json(mail)) return mail.ident - - + + def update_draft(self, mail): mail = Mail.from_json(mail) self.mailset.update(mail) -- cgit v1.2.3