Bläddra i källkod

Python3 - use bytes only

Oz N Tiram 8 år sedan
förälder
incheckning
5a091015ec
2 ändrade filer med 8 tillägg och 8 borttagningar
  1. 2 2
      pwman/data/nodes.py
  2. 6 6
      pwman/ui/cli.py

+ 2 - 2
pwman/data/nodes.py

@@ -78,7 +78,7 @@ class Node(object):
             node._password = password.strip()
             node._url = url.strip()
             node._notes = notes.strip()
-            node._tags = [t.strip() for t in tags] 
+            node._tags = [t.strip() for t in tags]
         else:
             node._username = bytes(username, 'utf8').strip()
             node._password = bytes(password, 'utf8').strip()
@@ -123,7 +123,7 @@ class Node(object):
     def tags(self):
         enc = CryptoEngine.get()
         try:
-            return [enc.decrypt(tag).decode() for tag in
+            return [enc.decrypt(tag) for tag in
                     filter(None, self._tags)]
         except Exception:
             return [tag for tag in filter(None, self._tags)]

+ 6 - 6
pwman/ui/cli.py

@@ -21,7 +21,6 @@
 from __future__ import print_function
 
 import cmd
-import os
 import sys
 
 
@@ -37,12 +36,13 @@ except ImportError as e:  # pragma: no cover
 
 
 from pwman.ui.baseui import BaseCommands
-from pwman import (get_conf_options, get_db_version, version, website, parser_options)
+from pwman import (get_conf_options, get_db_version, version, website, parser_options)  # noqa
 from pwman.ui.tools import CLICallback
 from pwman.data import factory
 from pwman.exchange.importer import Importer
 from pwman.util.crypto_engine import CryptoEngine
-from pwman.util.crypto_engine import AES
+import pwman.util
+
 
 class PwmanCli(cmd.Cmd, BaseCommands):
     """
@@ -100,12 +100,12 @@ def main():
     xselpath, dbtype, config = get_conf_options(args, OSX)
     dburi = config.get_value('Database', 'dburi')
 
-    if os.path.join("Crypto", "Cipher") not in AES.__file__:  # we are using built in AES.py
+    if not pwman.util.has_cryptography:
         import colorama
         if config.get_value('Crypto', 'supress_warning').lower() != 'yes':
             print("{}WARNING: You are not using PyCrypto!!!\n"
-                  "WARNING: You should install PyCrypto for better security and "
-                  "perfomance\nWARNING: You can supress this warning by editing "
+                  "WARNING: You should install PyCrypto for better security and "  # noqa
+                  "perfomance\nWARNING: You can supress this warning by editing "  # noqa
                   "pwman config file.{}".format(colorama.Fore.RED,
                                                 colorama.Style.RESET_ALL))