Parcourir la source

fix broken tag functionallity

oz123 il y a 11 ans
Parent
commit
4aa370d68e
3 fichiers modifiés avec 14 ajouts et 14 suppressions
  1. 2 1
      pwman/data/nodes.py
  2. 1 2
      pwman/data/tags.py
  3. 11 11
      pwman/util/crypto.py

+ 2 - 1
pwman/data/nodes.py

@@ -116,7 +116,8 @@ class NewNode(object):
 
     @property
     def tags(self):
-        return [tag for tag in self._tags]
+        enc = CryptoEngine.get()
+        return [enc.decrypt(tag).strip() for tag in filter(None,self._tags)]
 
     @tags.setter
     def tags(self, value):

+ 1 - 2
pwman/data/tags.py

@@ -23,7 +23,7 @@
 from pwman.util.crypto import CryptoEngine
 
 
-class Tag:
+class Tag(object):
     """
     tags are specific strings used to classify nodes
     the methods in this class override some built-ins
@@ -31,7 +31,6 @@ class Tag:
     """
     def __init__(self, name):
         enc = CryptoEngine.get()
-        self.name = name
         self._name = enc.encrypt(name)
 
     def __eq__(self, other):

+ 11 - 11
pwman/util/crypto.py

@@ -209,17 +209,17 @@ class CryptoEngine(object):
         """
         return self._keycrypted
 
-    #def set_callback(self, callback):
-    #   """
-    #   set the callback function
-    #   """
-    #   self._callback = callback
-
-    #def get_callback(self):
-    #    """
-    #    return call back function
-    #    """
-    #    return self._callback
+    def set_callback(self, callback):
+        """
+        set the callback function
+        """
+        self._callback = callback
+
+    def get_callback(self):
+        """
+        return call back function
+        """
+        return self._callback
 
     def changepassword(self):
         """