check for required variables before doing anything else in _get_contents_from_keepass()

main
Franzi 1 year ago
parent a500310042
commit 91ff5c57eb
Signed by: kunsi
GPG Key ID: 12E3D2136B818350
  1. 6
      bwkeepass.py

@ -29,6 +29,9 @@ except (FileNotFoundError, IndexError):
def _get_contents_from_keepass(path):
if not KEEPASS_FILE or not KEEPASS_PASS:
raise FaultUnavailable('BW_KEEPASS_FILE and/or BW_KEEPASS_PASSWORD missing')
if isinstance(path, list):
list_path = path
string_path = '|'.join(path)
@ -47,9 +50,6 @@ def _get_contents_from_keepass(path):
path=list_path,
file=KEEPASS_FILE,
)):
if not KEEPASS_FILE or not KEEPASS_PASS:
raise FaultUnavailable('BW_KEEPASS_FILE and/or BW_KEEPASS_PASSWORD missing')
try:
keepass = PyKeePass(expanduser(KEEPASS_FILE), KEEPASS_PASS)

Loading…
Cancel
Save