mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
Merge pull request #1028 from marcus-h/lazy_password_callable_fix
Handle a callable in credentials._LazyPassword.__str__
This commit is contained in:
commit
bc9869bdc2
@ -40,9 +40,14 @@ class _LazyPassword(object):
|
||||
|
||||
def __str__(self):
|
||||
if self._password is None:
|
||||
self._password = self._pwfunc()
|
||||
if self._password is None:
|
||||
password = self._pwfunc()
|
||||
if callable(password):
|
||||
print('Warning: use of a deprecated credentials manager API.',
|
||||
file=sys.stderr)
|
||||
password = password()
|
||||
if password is None:
|
||||
raise oscerr.OscIOError(None, 'Unable to retrieve password')
|
||||
self._password = password
|
||||
return self._password
|
||||
|
||||
def __len__(self):
|
||||
|
Loading…
Reference in New Issue
Block a user