1. Kang Zhang
  2. Python Keyring Lib


Jason R. Coombs  committed 6281d74

Fixed minor issues with get_all_keyring

  • Participants
  • Parent commits c40d550
  • Branches prioritized backends

Comments (0)

Files changed (2)

File keyring/backend.py

View file
 Keyring implementation support
+import itertools
 from keyring.py25compat import abc
 from keyring import errors
     __metaclass__ = KeyringBackendMeta
-    @abc.abstractproperty
+    #@abc.abstractproperty
     def priority(cls):
         Each backend class must supply a priority, a number (float or integer)
     Return a list of all implemented keyrings that can be constructed without
-    return list(keyring.util.suppress_exceptions(KeyringBackend._classes,
+    def is_class_viable(keyring_cls):
+        try:
+            keyring_cls.priority
+        except RuntimeError:
+            return False
+        return True
+    all_classes = KeyringBackend._classes
+    viable_classes = itertools.ifilter(is_class_viable, all_classes)
+    return list(keyring.util.suppress_exceptions(viable_classes,
 # for backward-compatibility
 from keyring.backends.Windows import EncryptedKeyring as Win32CryptoKeyring
 from keyring.backends.Windows import WinVaultKeyring
 from keyring.backends.Windows import RegistryKeyring as Win32CryptoRegistry
-from keyring.backends.Windows import select_windows_backend
 from keyring.backends.Google import DocsKeyring as GoogleDocsKeyring
 from keyring.credentials import Credential
 from keyring.credentials import SimpleCredential as BaseCredential

File keyring/backends/multi.py

View file
 import itertools
+from keyring.util import properties
 from keyring.backend import KeyringBackend
 from keyring import errors