diff options
author | Patrick Maia <patrickjourdanmaia@gmail.com> | 2015-02-06 21:03:16 +0000 |
---|---|---|
committer | Patrick Maia <patrickjourdanmaia@gmail.com> | 2015-02-06 21:03:16 +0000 |
commit | ff4ebf784e4df248c20d01dcc7e8905aee74d79c (patch) | |
tree | d0c8a7fce10ba30f3a36c9aa0d677fda68c6ab61 /service/pixelated/adapter | |
parent | f55a7e5198bfcb8d85c60d86bdf37c18f08c40db (diff) |
Issue #276 - saves tags in the same case they arrive
Diffstat (limited to 'service/pixelated/adapter')
-rw-r--r-- | service/pixelated/adapter/services/mail_service.py | 5 | ||||
-rw-r--r-- | service/pixelated/adapter/services/tag_service.py | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/service/pixelated/adapter/services/mail_service.py b/service/pixelated/adapter/services/mail_service.py index 1e0a0414..40a7c6ff 100644 --- a/service/pixelated/adapter/services/mail_service.py +++ b/service/pixelated/adapter/services/mail_service.py @@ -35,7 +35,7 @@ class MailService: return self.querier.mails(mail_ids), total def update_tags(self, mail_id, new_tags): - new_tags = [x.lower() for x in map(lambda e: e.strip(), new_tags) if x != ''] + new_tags = self._filter_white_space_tags(new_tags) reserved_words = self.tag_service.extract_reserved(new_tags) if len(reserved_words): raise ValueError('None of the following words can be used as tags: ' + ' '.join(reserved_words)) @@ -45,6 +45,9 @@ class MailService: return mail + def _filter_white_space_tags(self, tags): + return filter(bool, map(lambda e: e.strip(), tags)) + def mail(self, mail_id): return self.querier.mail(mail_id) diff --git a/service/pixelated/adapter/services/tag_service.py b/service/pixelated/adapter/services/tag_service.py index 22cfb051..601392bb 100644 --- a/service/pixelated/adapter/services/tag_service.py +++ b/service/pixelated/adapter/services/tag_service.py @@ -23,4 +23,5 @@ class TagService: @classmethod def extract_reserved(cls, tags): + tags = map(lambda tag: tag.lower(), tags) return {tag.name for tag in cls.SPECIAL_TAGS if tag.name in tags} |