From 56565e49ed72f88e6dd0d54acdbcb3cfe4d1b95b Mon Sep 17 00:00:00 2001 From: Lisa Junger Date: Fri, 21 Nov 2014 16:14:19 +0100 Subject: started to move reply template to be part of mail. --- service/pixelated/adapter/mail.py | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'service/pixelated') diff --git a/service/pixelated/adapter/mail.py b/service/pixelated/adapter/mail.py index 6beac4c2..092b4970 100644 --- a/service/pixelated/adapter/mail.py +++ b/service/pixelated/adapter/mail.py @@ -319,23 +319,11 @@ class PixelatedMail(Mail): return self.hdoc.content["headers"].get("OpenPGP", None) is not None def as_dict(self): - return { - 'header': {k.lower(): v for k, v in self.headers.items()}, - 'ident': self.ident, - 'tags': list(self.tags), - 'status': list(self.status), - 'security_casing': self.security_casing, - 'body': self.body, - 'mailbox': self.mailbox_name.lower(), - 'attachments': self.parts['attachments'] if self.parts else [] - } - - def to_reply_template(self): - template = self.as_dict() - recipients = template['header']['to'][0] + dict_mail = super(PixelatedMail, self).as_dict() + recipients = dict_mail['header']['to'][0] for recipient in recipients: if recipient == InputMail.FROM_EMAIL_ADDRESS: recipients.remove(recipient) - template['header']['to'][0] = recipients - template['header']['subject'] = 'Re: %s' % template['header']['subject'] - return template + dict_mail['header']['to'][0] = recipients + dict_mail['header']['subject'] = 'Re: %s' % dict_mail['header']['subject'] + return dict_mail -- cgit v1.2.3