Pārlūkot izejas kodu

bug fix - filter works properly with encrypted tags

oz123 11 gadi atpakaļ
vecāks
revīzija
1ef3699913
3 mainītis faili ar 3 papildinājumiem un 12 dzēšanām
  1. 1 7
      pwman/data/drivers/sqlite.py
  2. 0 1
      pwman/tests/db_tests.py
  3. 2 4
      pwman/ui/cli.py

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

@@ -204,7 +204,6 @@ class SQLiteDatabaseNewForm(Database):
 
     def listnodes(self):
         sql = ''
-        params = []
         if len(self._filtertags) == 0:
             sql = "SELECT ID FROM NODES ORDER BY ID ASC"
         else:
@@ -216,14 +215,9 @@ class SQLiteDatabaseNewForm(Database):
                     first = False
                 sql += ("SELECT NODE FROM LOOKUP LEFT JOIN TAGS ON TAG = "
                         " TAGS.ID WHERE TAGS.DATA = ? ")
-                params.append(t._name)
+                params = [t.name.strip()]
         try:
             self._cur.execute(sql, params)
-            # ids = []
-            # row = self._cur.fetchone()
-            # while row is not None:
-            #   ids.append(row[0])
-            #   row = self._cur.fetchone()
             rows = self._cur.fetchall()
             ids = [row[0] for row in rows]
             return ids

+ 0 - 1
pwman/tests/db_tests.py

@@ -158,4 +158,3 @@ class CLITests(unittest.TestCase):
         # the second was added just now.
         # This will pass only when running all the tests than ...
         self.assertEqual(len(rows), 2)
-

+ 2 - 4
pwman/ui/cli.py

@@ -783,7 +783,7 @@ class BaseCommands(PwmanCliOld):
                     i = 0
                     c = tools.getonechar("Press <Space> for more,"
                                          " or 'Q' to cancel")
-                    if c == 'q':
+                    if c.lower() == 'q':
                         break
 
         except Exception, e:
@@ -792,9 +792,7 @@ class BaseCommands(PwmanCliOld):
     def do_filter(self, args):
         tagstrings = args.split()
         try:
-            tags = []
-            for ts in tagstrings:
-                tags.append(TagN(ts))
+            tags = [TagN(ts) for ts in tagstrings]
             self._db.filter(tags)
             tags = self._db.currenttags()
             print ("Current tags: ",)