Parcourir la source

- fix bug of how tags are handeld when editing node

oz123 il y a 11 ans
Parent
commit
af4c7a4ae0
4 fichiers modifiés avec 10 ajouts et 9 suppressions
  1. 1 0
      pwman/data/drivers/sqlite.py
  2. 0 1
      pwman/data/nodes.py
  3. 7 6
      pwman/data/tags.py
  4. 2 2
      pwman/ui/cli.py

+ 1 - 0
pwman/data/drivers/sqlite.py

@@ -167,6 +167,7 @@ class SQLiteDatabaseNewForm(Database):
     def editnode(self, id, node):
     def editnode(self, id, node):
         try:
         try:
             sql = "UPDATE NODES SET DATA = ? WHERE ID = ?"
             sql = "UPDATE NODES SET DATA = ? WHERE ID = ?"
+            #sql = "INSERT OR UPDATE NODES SET DATA = ? WHERE ID = ?"
             self._cur.execute(sql, [node.dump_edit_to_db()[0], id])
             self._cur.execute(sql, [node.dump_edit_to_db()[0], id])
         except sqlite.DatabaseError, e:
         except sqlite.DatabaseError, e:
             raise DatabaseException("SQLite: %s" % (e))
             raise DatabaseException("SQLite: %s" % (e))

+ 0 - 1
pwman/data/nodes.py

@@ -103,7 +103,6 @@ class NewNode(object):
         the username does not containg space as the last character.
         the username does not containg space as the last character.
         The same is also true for the password.
         The same is also true for the password.
         """
         """
-
         enc = CryptoEngine.get()
         enc = CryptoEngine.get()
         return enc.decrypt(self._username).strip()
         return enc.decrypt(self._username).strip()
 
 

+ 7 - 6
pwman/data/tags.py

@@ -1,15 +1,15 @@
 #============================================================================
 #============================================================================
 # This file is part of Pwman3.
 # This file is part of Pwman3.
-# 
+#
 # Pwman3 is free software; you can redistribute it and/or modify
 # Pwman3 is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License, version 2
 # it under the terms of the GNU General Public License, version 2
-# as published by the Free Software Foundation; 
-# 
+# as published by the Free Software Foundation;
+#
 # Pwman3 is distributed in the hope that it will be useful,
 # Pwman3 is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # You should have received a copy of the GNU General Public License
 # along with Pwman3; if not, write to the Free Software
 # along with Pwman3; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
@@ -22,6 +22,7 @@
 
 
 from pwman.util.crypto import CryptoEngine
 from pwman.util.crypto import CryptoEngine
 
 
+
 class Tag:
 class Tag:
 
 
     def __init__(self, name):
     def __init__(self, name):
@@ -32,7 +33,7 @@ class Tag:
             return True
             return True
         else:
         else:
             return False
             return False
-        
+
     def get_name(self):
     def get_name(self):
         enc = CryptoEngine.get()
         enc = CryptoEngine.get()
         return enc.decrypt(self._name)
         return enc.decrypt(self._name)
@@ -40,6 +41,6 @@ class Tag:
     def set_name(self, name):
     def set_name(self, name):
         enc = CryptoEngine.get()
         enc = CryptoEngine.get()
         self._name = enc.encrypt(name)
         self._name = enc.encrypt(name)
-                
+
     def __str__(self):
     def __str__(self):
         return self.get_name()
         return self.get_name()

+ 2 - 2
pwman/ui/cli.py

@@ -876,11 +876,11 @@ class PwmanCliNew(PwmanCli):
 
 
         if default:
         if default:
             for t in default:
             for t in default:
-                defaultstr += "%s " % (t.get_name())
+                defaultstr += "%s " % (t)
         else:
         else:
             tags = self._db.currenttags()
             tags = self._db.currenttags()
             for t in tags:
             for t in tags:
-                defaultstr += "%s " % (t.get_name())
+                defaultstr += "%s " % (t)
 
 
         strings = []
         strings = []
         tags = self._db.listtags(True)
         tags = self._db.listtags(True)