Commit c105d6f1 authored by Jason R. Coombs's avatar Jason R. Coombs

Simplify logic by eliminating retries in password prompt and returning results directly.

parent a3b119e1
...@@ -24,21 +24,15 @@ class upload(orig.upload): ...@@ -24,21 +24,15 @@ class upload(orig.upload):
""" """
try: try:
keyring = __import__('keyring') keyring = __import__('keyring')
password = keyring.get_password(self.repository, self.username) return keyring.get_password(self.repository, self.username)
except Exception: except Exception:
password = None pass
finally:
return password
def _prompt_for_password(self): def _prompt_for_password(self):
""" """
Prompt for a password on the tty. Suppress Exceptions. Prompt for a password on the tty. Suppress Exceptions.
""" """
password = None
try: try:
while not password: return getpass.getpass()
password = getpass.getpass()
except (Exception, KeyboardInterrupt): except (Exception, KeyboardInterrupt):
password = None pass
finally:
return password
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment