summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorDuda Dornelles <dudassdornelles@gmail.com>2015-01-27 16:26:01 -0200
committerPixpoa pairing <pixpoapairing@pixelated-project.org>2015-01-27 16:26:01 -0200
commita211149d2a1bdf21b970cdff1bd5a31a9ecdadaf (patch)
tree01ee96303bb438e2acfeada4324f98dd1939f4fa /service
parent2f25e6429d9d846632314d093591ad413fac0d9e (diff)
#184 not creating empty tags of any length (as opposed to only empty strings with len==0)
Diffstat (limited to 'service')
-rw-r--r--service/pixelated/resources/mail_resource.py2
-rw-r--r--service/test/integration/test_tags.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/service/pixelated/resources/mail_resource.py b/service/pixelated/resources/mail_resource.py
index 396ccd74..fd1d255f 100644
--- a/service/pixelated/resources/mail_resource.py
+++ b/service/pixelated/resources/mail_resource.py
@@ -15,7 +15,7 @@ class MailTags(Resource):
def render_POST(self, request):
content_dict = json.loads(request.content.read())
- new_tags = [x.lower() for x in content_dict['newtags'] if x != '']
+ new_tags = [x.lower() for x in map(lambda e: e.strip(), content_dict['newtags']) if x != '']
try:
self._mail_service.update_tags(self._mail_id, new_tags)
mail = self._mail_service.mail(self._mail_id)
diff --git a/service/test/integration/test_tags.py b/service/test/integration/test_tags.py
index b32e89c7..0efcbb6b 100644
--- a/service/test/integration/test_tags.py
+++ b/service/test/integration/test_tags.py
@@ -46,7 +46,7 @@ class TagsTest(SoledadTestBase):
mail = MailBuilder().with_subject('Mail with tags').build_input_mail()
self.client.add_mail_to_inbox(mail)
- self.post_tags(mail.ident, self._tags_json(['tag1', '']))
+ self.post_tags(mail.ident, self._tags_json(['tag1', ' ']))
mail = self.get_mail(mail.ident)