diff options
author | Victor Shyba <victor.shyba@gmail.com> | 2014-08-13 15:59:58 -0300 |
---|---|---|
committer | Victor Shyba <victor.shyba@gmail.com> | 2014-08-13 15:59:58 -0300 |
commit | 3d3e4a502373c3f90b3ef7cce1a748255b5f0721 (patch) | |
tree | 4ba7500c184a1aeab3c277ca12961eea30d94c64 | |
parent | e61fdb9721872614f8672b715dadb9cbd23a84ee (diff) |
tags are case insensitive, apply lower function before adding to the tags set
-rw-r--r-- | py-fake-service/app/adapter/tag.py | 2 | ||||
-rw-r--r-- | py-fake-service/app/adapter/tagsset.py | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/py-fake-service/app/adapter/tag.py b/py-fake-service/app/adapter/tag.py index a0f3ec1b..bc5bee95 100644 --- a/py-fake-service/app/adapter/tag.py +++ b/py-fake-service/app/adapter/tag.py @@ -10,7 +10,7 @@ class Tag: } self.ident = ident - self.name = name + self.name = name.lower() self.default = name in self.DEFAULT_TAGS def increment_count(self): diff --git a/py-fake-service/app/adapter/tagsset.py b/py-fake-service/app/adapter/tagsset.py index 803c921c..67f4379d 100644 --- a/py-fake-service/app/adapter/tagsset.py +++ b/py-fake-service/app/adapter/tagsset.py @@ -16,6 +16,7 @@ class TagsSet: def mark_as_read(self, tags): for tag in tags: + tag = tag.lower() tag = self.tags.get(tag) tag.increment_read() @@ -30,7 +31,8 @@ class TagsSet: self.tags.get(tag).decrement_count() def _create_new_tag(self, tag): - tag = self.tags.setdefault(tag, Tag(tag, self.ident)) + tag = Tag(tag, self.ident) + tag = self.tags.setdefault(tag.name, tag) self.ident += 1 return tag |