Skip to content

Commit

Permalink
Don't use singleton CredentialStore in requires_credentials decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet committed Jun 2, 2020
1 parent e6a4f0f commit 427d898
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/pyze/api/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ class MissingCredentialException(Exception):
def requires_credentials(*names):
def _requires_credentials(func):
def inner(*args, **kwargs):
credentials = None
if args[0] and hasattr(args[0], '_credentials'):
credentials = args[0]._credentials
elif args[0] and hasattr(args[0], '_kamereon'):
credentials = args[0]._kamereon._credentials
for name in names:
if name not in CredentialStore():
if name not in credentials:
raise MissingCredentialException(name)
return func(*args, **kwargs)

Expand Down

0 comments on commit 427d898

Please sign in to comment.