summaryrefslogtreecommitdiff
path: root/service/pixelated
diff options
context:
space:
mode:
authorPatrick Maia and Victor Shyba <pixelated-team+pmaia+vshyba@thoughtworks.com>2014-09-07 16:55:57 +0000
committerPatrick Maia <pmaia@thoughtworks.com>2014-09-07 16:55:57 +0000
commitff01686c1b38d26b0ef54833cf3463ab0bf73bf8 (patch)
tree464343b9b4d52e714289a4165c5f64d0a4f9fe71 /service/pixelated
parent2628ad607bec6f147a4a73786976585c74b483c7 (diff)
#51 - some tests for TagIndex and the addition of method TagIndex.add
Diffstat (limited to 'service/pixelated')
-rw-r--r--service/pixelated/adapter/tag_index.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/service/pixelated/adapter/tag_index.py b/service/pixelated/adapter/tag_index.py
index 25108643..ea69be1a 100644
--- a/service/pixelated/adapter/tag_index.py
+++ b/service/pixelated/adapter/tag_index.py
@@ -34,6 +34,10 @@ class TagIndex:
self.close_db() # force flush
self.db = dbm.open(self.db_path, 'c')
+ def add(self, tag):
+ if tag.name not in self.db:
+ self.set(tag)
+
def get(self, tag_name):
if tag_name in self.db:
return Tag.from_json_string(self.db.get(tag_name))