diff options
author | Tomás Touceda <chiiph@leap.se> | 2014-08-15 10:32:37 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2014-08-15 10:32:37 -0300 |
commit | e8c028f3eb6cd0681f039c456dc1ac45c98d598f (patch) | |
tree | b7e84ebafad106726308d3c87f58ad1d900d66d7 /src/leap/bitmask/util/keyring_helpers.py | |
parent | 159dbe295148975bdfe9a50f871254aa9adf2328 (diff) | |
parent | fb9bad95cc4bd2769af5f91c2f0cac1be4c3c617 (diff) |
Merge branch 'release-0.6.1'0.6.1
Diffstat (limited to 'src/leap/bitmask/util/keyring_helpers.py')
-rw-r--r-- | src/leap/bitmask/util/keyring_helpers.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/leap/bitmask/util/keyring_helpers.py b/src/leap/bitmask/util/keyring_helpers.py index ee2d7a1c..2b729b65 100644 --- a/src/leap/bitmask/util/keyring_helpers.py +++ b/src/leap/bitmask/util/keyring_helpers.py @@ -46,15 +46,12 @@ def _get_keyring_with_fallback(): This is a workaround for the cases in which the keyring module chooses an insecure keyring by default (ie, inside a virtualenv). """ - if not keyring: + if keyring is None: return None kr = keyring.get_keyring() if not canuse(kr): - try: - kr_klass = keyring.backends.SecretService - kr = kr_klass.Keyring() - except AttributeError: - logger.warning("Keyring cannot find SecretService Backend") + logger.debug("No usable keyring found") + return None logger.debug("Selected keyring: %s" % (kr.__class__,)) if not canuse(kr): logger.debug("Not using default keyring since it is obsolete") @@ -67,7 +64,7 @@ def has_keyring(): :rtype: bool """ - if not keyring: + if keyring is None: return False kr = _get_keyring_with_fallback() return canuse(kr) @@ -79,7 +76,7 @@ def get_keyring(): :rtype: keyringBackend or None """ - if not keyring: + if keyring is None: return False kr = _get_keyring_with_fallback() return kr if canuse(kr) else None |