Skip to content

Commit

Permalink
Merge pull request #20 from aarranz/feature/improve-missing-conf-erro…
Browse files Browse the repository at this point in the history
…r-msg

Feature/improve missing conf error msg
  • Loading branch information
aarranz committed Jul 7, 2018
2 parents ec89464 + 19c922e commit 2f832e2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ckanext/oauth2/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ def __init__(self):
# Init db
db.init_db(model)

if self.authorization_endpoint == "" or self.token_endpoint == "" or self.client_id == "" or self.client_secret == "" \
or self.profile_api_url == "" or self.profile_api_user_field == "" or self.profile_api_mail_field == "":
raise ValueError('authorization_endpoint, token_endpoint, client_id, client_secret, '
'profile_api_url, profile_api_user_field and profile_api_mail_field are required')
missing = [key for key in REQUIRED_CONF if getattr(self, key, "") == ""]
if missing:
raise ValueError("Missing required oauth2 conf: %s" % ", ".join(missing))
elif self.scope == "":
self.scope = None

Expand Down

0 comments on commit 2f832e2

Please sign in to comment.