diff options
author | Lisa Junger <ljunger@thoughtworks.com> | 2014-11-21 16:14:19 +0100 |
---|---|---|
committer | Alexandre Pretto Nunes <anunes@thoughtworks.com> | 2014-12-03 15:49:20 -0200 |
commit | 56565e49ed72f88e6dd0d54acdbcb3cfe4d1b95b (patch) | |
tree | a5818c9b89de0a71806ad6d7d0c9c77c7f6cacb9 /service/pixelated | |
parent | f273d2abeefa0d77d306bcfab3135195afbc31c3 (diff) |
started to move reply template to be part of mail.
Diffstat (limited to 'service/pixelated')
-rw-r--r-- | service/pixelated/adapter/mail.py | 22 |
1 files changed, 5 insertions, 17 deletions
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 |