summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorPatrick Maia and Victor Shyba <pixelated-team+pmaia+vshyba@thoughtworks.com>2014-09-05 23:35:22 +0000
committerPatrick Maia <pmaia@thoughtworks.com>2014-09-05 23:35:22 +0000
commit01f4ba64576a21d68ce79acbd8cefd0f2f5dc375 (patch)
tree36a32871e2ea6d891b7354df2f042f003a854e29 /service
parent3c79a54ab332e15f31a4a57a4a9baabf4b62e26a (diff)
#51 - uses list every time we need to convert to json
Diffstat (limited to 'service')
-rw-r--r--service/pixelated/adapter/pixelated_mail.py4
-rw-r--r--service/pixelated/adapter/tag.py3
-rw-r--r--service/test/adapter/test_tag.py2
3 files changed, 4 insertions, 5 deletions
diff --git a/service/pixelated/adapter/pixelated_mail.py b/service/pixelated/adapter/pixelated_mail.py
index 31e8ccc7..2b9ccd35 100644
--- a/service/pixelated/adapter/pixelated_mail.py
+++ b/service/pixelated/adapter/pixelated_mail.py
@@ -82,7 +82,7 @@ class PixelatedMail:
def _persist_mail_tags(self, current_tags):
hdoc = self.leap_mail.hdoc
- hdoc.content['headers']['X-Tags'] = current_tags
+ hdoc.content['headers']['X-Tags'] = list(current_tags)
self.leap_mail._soledad.put_doc(hdoc)
def has_tag(self, tag):
@@ -95,7 +95,7 @@ class PixelatedMail:
return {
'header': _headers,
'ident': self.ident,
- 'tags': self.tags,
+ 'tags': list(self.tags),
'status': statuses,
'security_casing': self.security_casing,
'body': self.body
diff --git a/service/pixelated/adapter/tag.py b/service/pixelated/adapter/tag.py
index 45a972ab..ba545043 100644
--- a/service/pixelated/adapter/tag.py
+++ b/service/pixelated/adapter/tag.py
@@ -62,12 +62,11 @@ class Tag:
'read': 0,
'starred': 0,
'replied': 0},
- 'mails': self.mails
+ 'mails': list(self.mails)
}
def as_json_string(self):
tag_dict = self.as_dict()
- tag_dict['mails'] = list(self.mails)
return json.dumps(tag_dict)
def __repr__(self):
diff --git a/service/test/adapter/test_tag.py b/service/test/adapter/test_tag.py
index 1f0478d3..85887d37 100644
--- a/service/test/adapter/test_tag.py
+++ b/service/test/adapter/test_tag.py
@@ -39,7 +39,7 @@ class TestTag(unittest.TestCase):
def test_as_dict_puts_all_tag_attributes_in_the_returning_dict(self):
tag = Tag('some_tag', default=True)
tag.counts = {'total': 0, 'read': 0, 'starred': 0, 'replied': 0}
- tag.mails = set([1, 2, 3])
+ tag.mails = [1, 2, 3]
tag_dict = tag.as_dict()