From 903940303481a699061ac3416e719389da92d9f2 Mon Sep 17 00:00:00 2001 From: Duda Dornelles Date: Tue, 28 Oct 2014 10:45:24 +0100 Subject: Adding some comments on where we are overriding properties. We must fix this. DO NOT OVERRIDE PROPERTIES --- service/pixelated/adapter/mail.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'service') diff --git a/service/pixelated/adapter/mail.py b/service/pixelated/adapter/mail.py index 82b4d0a6..e10136ec 100644 --- a/service/pixelated/adapter/mail.py +++ b/service/pixelated/adapter/mail.py @@ -27,7 +27,6 @@ from pycryptopp.hash import sha256 class Mail: - @property def to(self): return self.headers['To'] @@ -137,7 +136,8 @@ class InputMail(Mail): hd[fields.SUBJECT_KEY] = self.headers.get('Subject') hd[fields.TYPE_KEY] = fields.TYPE_HEADERS_VAL hd[fields.BODY_KEY] = self._get_body_phash() - hd[fields.PARTS_MAP_KEY] = walk.walk_msg_tree(walk.get_parts(self._mime_multipart), body_phash=self._get_body_phash())['part_map'] + hd[fields.PARTS_MAP_KEY] = \ + walk.walk_msg_tree(walk.get_parts(self._mime_multipart), body_phash=self._get_body_phash())['part_map'] self._hd = hd return hd @@ -172,15 +172,22 @@ class InputMail(Mail): def from_dict(mail_dict): input_mail = InputMail() input_mail.headers = {key.capitalize(): value for key, value in mail_dict.get('header', {}).items()} + + # XXX this is overriding the property in PixelatedMail input_mail.headers['Date'] = pixelated.support.date.iso_now() + + # XXX this is overriding the property in PixelatedMail input_mail.body = mail_dict.get('body', '') + + # XXX this is overriding the property in the PixelatedMail input_mail.tags = set(mail_dict.get('tags', [])) + input_mail._status = set(mail_dict.get('status', [])) return input_mail class PixelatedMail(Mail): - + @staticmethod def from_soledad(fdoc, hdoc, bdoc, soledad_querier=None, parts=None): mail = PixelatedMail() -- cgit v1.2.3