mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-29 22:16:13 +02:00
Fix set_keychain errors (#964)
* fix keyring problems * black * remove else and use stderr * black * add tests * black * change description of nokeyring * dumb syntax error
This commit is contained in:
parent
ca482b0a46
commit
0b9137c17d
3 changed files with 52 additions and 4 deletions
11
jrnl/util.py
11
jrnl/util.py
|
@ -59,9 +59,6 @@ def create_password(
|
|||
|
||||
if yesno("Do you want to store the password in your keychain?", default=True):
|
||||
set_keychain(journal_name, pw)
|
||||
else:
|
||||
set_keychain(journal_name, None)
|
||||
|
||||
return pw
|
||||
|
||||
|
||||
|
@ -107,7 +104,13 @@ def set_keychain(journal_name, password):
|
|||
except keyring.errors.PasswordDeleteError:
|
||||
pass
|
||||
else:
|
||||
keyring.set_password("jrnl", journal_name, password)
|
||||
try:
|
||||
keyring.set_password("jrnl", journal_name, password)
|
||||
except keyring.errors.NoKeyringError:
|
||||
print(
|
||||
"Keyring backend not found. Please install one of the supported backends by visiting: https://pypi.org/project/keyring/",
|
||||
file=sys.stderr,
|
||||
)
|
||||
|
||||
|
||||
def yesno(prompt, default=True):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue