Kaynağa Gözat

- fix bug of how tags are handeld when editing node

oz123 11 yıl önce
ebeveyn
işleme
af4c7a4ae0
4 değiştirilmiş dosya ile 10 ekleme ve 9 silme
  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):
         try:
             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])
         except sqlite.DatabaseError, 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 same is also true for the password.
         """
-
         enc = CryptoEngine.get()
         return enc.decrypt(self._username).strip()
 

+ 7 - 6
pwman/data/tags.py

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

+ 2 - 2
pwman/ui/cli.py

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