Explorar o código

Add __repr__ method to new Node class

oz123 %!s(int64=10) %!d(string=hai) anos
pai
achega
aa6323b469
Modificáronse 1 ficheiros con 7 adicións e 0 borrados
  1. 7 0
      pwman/data/nodes.py

+ 7 - 0
pwman/data/nodes.py

@@ -154,6 +154,13 @@ class Node(object):
         node._tags = [t.strip() for t in tags]
         return node
 
+    def __repr__(self):
+        """we use this method to write node to the database"""
+        res = u''
+        for item in self.__dir__:
+            res += self.__dir__[item]
+        return res
+
     @property
     def password(self):
         """Get the current password."""