Selaa lähdekoodia

Try to fix python3 compatibility ...

Work in progress ...
oz123 10 vuotta sitten
vanhempi
commit
8c1357abab
2 muutettua tiedostoa jossa 4 lisäystä ja 1 poistoa
  1. 2 1
      pwman/tests/test_tools.py
  2. 2 0
      pwman/util/crypto.py

+ 2 - 1
pwman/tests/test_tools.py

@@ -37,7 +37,8 @@ class DummyCallback3(Callback):
         return u'newsecret'
 
     def getsecret(self, question):
-        return u'12345'
+        ans = '12345'
+        return ans
 
     def getnewsecret(self, question):
         return u'newsecret'

+ 2 - 0
pwman/util/crypto.py

@@ -426,6 +426,8 @@ class CryptoEngine(object):
         """
         retrieve encrypted data
         """
+        if sys.version_info.major > 2:
+            return plaintext
         try:
             plaintext.decode('utf-8')
         except UnicodeDecodeError: