Эх сурвалжийг харах

Merge branch 'develop' of github.com:pwman3/pwman3 into develop

Oz N Tiram 6 жил өмнө
parent
commit
0b63adcb72
2 өөрчлөгдсөн 18 нэмэгдсэн , 11 устгасан
  1. 2 2
      README.md
  2. 16 9
      pwman/ui/tools.py

+ 2 - 2
README.md

@@ -5,8 +5,8 @@
 [![Coverage Status](https://coveralls.io/repos/pwman3/pwman3/badge.png)](https://coveralls.io/r/pwman3/pwman3?branch=develop)
 [![Documentation Status](https://readthedocs.org/projects/pwman3/badge/?version=latest)](https://readthedocs.org/projects/pwman3/?badge=latest)
 
-A nice command line password manager, which can use different database to store your passwords (currently, SQLite, MySQL, 
-    and Postgresql and MongoDB are supported).
+A lightweight command line password manager, which can use different database to store your passwords
+(currently, SQLite, MySQL, Postgresql and MongoDB are supported).
 Pwman3 can also copy passwords to the clipboard without exposing them!
 Besides managing and storing passwords, Pwman3 can also generate passwords using different algorithms. 
 

+ 16 - 9
pwman/ui/tools.py

@@ -127,16 +127,18 @@ def open_url(link, macosx=False,):  # pragma: no cover
         print("Executing open_url failed with:\n", E)
 
 
-def getinput(question, default="", reader=raw_input,
-             completer=None, width=_defaultwidth):  # pragma: no cover
+def getinput(question, default="", reader=input,
+             completer=None, width=_defaultwidth, drop="drop"):  # pragma: no cover
     """
     http://stackoverflow.com/questions/2617057/\
             supply-inputs-to-python-unittests
     """
-    if reader == raw_input:
+    if reader == input:
         if not _readline_available:
-            val = raw_input(question.ljust(width))
-            if val:
+            val = input(question.ljust(width))
+            if val == "drop":
+                return ""
+            elif val:
                 return val
             else:
                 return default
@@ -150,11 +152,16 @@ def getinput(question, default="", reader=raw_input,
                 readline.get_completer()
                 readline.set_completer(completer)
 
-            x = raw_input(question.ljust(width))
+            x = input(question.ljust(width))
 
             if _readline_available:
                 readline.set_startup_hook()
-            return x if x else default
+            if x == "drop":
+                return ""
+            elif x:
+                return x
+            else:
+                return default
 
     else:
         return reader()
@@ -218,10 +225,10 @@ def set_selection(new_node, items, selection, reader):  # pragma: no cover
         items[3].getter = new_node.notes
     elif selection == 4:
         taglist = getinput(
-            "Tags:", " ".join(t.encode() for t in new_node.tags))
+            "Tags:", " ".join(map(bytes.decode, new_node.tags)))
         tags = taglist.split()
         new_node.tags = tags
-        items[4].getter = ','.join(t.encode() for t in new_node.tags)
+        items[4].getter = ','.join(t for t in tags)
 
 
 class CMDLoop(object):