Commits

Yuriy Netesov committed e38023d

*** empty log message ***

Comments (0)

Files changed (4)

tagsystem/payload.py

     pass
 
 class Payload:
-    def __init__(self, model, tags):
+    def __init__(self, model, tagSystem):
         self._model = model
         self._tags = tags
 
     def tag(self, tagName):
+        self._tags.touch(tagName)
+        self._model
         
 class Tag:
     def __init__(self, model):
         self._model = model
+
+    def get_name(self):
+        return self._model.name
+
+    def rename(self, newName):
+        self._model.name = newName
+        self._model.save()

tagsystem/tags.py

-from tagjumper.tagsystem.tag import Tag, TagModel
-from tagjumper.tagsystem.dbconnection import get_db_connection
+from tagsystem.tag import Tag, TagModel
+from tagsystem.dbconnection import get_db_connection
 import sqlalchemy
 
 class Tags:
-    def __init__(self):
+    def __init__(self, tagsystem):
+        self._tagsystem = tagsystem
         self._touch_table()
         metadata = sqlalchemy.BoundMetaData(get_db_connection())
         self._tagsTable = sqlalchemy.Table('tags', metadata, autoload=True)

tagsystem/tagsystem.py

 from payloads import Payloads
 
 def TagSystem:
-    
+    def __init__(self):
+        self._tags = Tags(self)
+        self._payloads = Payloads(self)