Browse Source

Try to fix python3 compatibility ...

Work in progress ...
oz123 10 năm trước cách đây
mục cha
commit
8c1357abab
2 tập tin đã thay đổi với 4 bổ sung1 xóa
  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: