From a211149d2a1bdf21b970cdff1bd5a31a9ecdadaf Mon Sep 17 00:00:00 2001 From: Duda Dornelles Date: Tue, 27 Jan 2015 16:26:01 -0200 Subject: #184 not creating empty tags of any length (as opposed to only empty strings with len==0) --- service/pixelated/resources/mail_resource.py | 2 +- service/test/integration/test_tags.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'service') 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) -- cgit v1.2.3