Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ext: fix init without oauthlib.client extension #24

Conversation

JavierDelgadoFernandez
Copy link
Contributor

  • Fixes the initialization of the extension when there is no
    oauthlib.client object in extensions.

Signed-off-by: Javier Delgado javier.delgado.fernandez@cern.ch

@@ -46,7 +47,10 @@ def __init__(self, app):
# Connect signal to remove access tokens on logout
user_logged_out.connect(oauth_logout_handler)

oauth = app.extensions['oauthlib.client']
if 'oauthlib.client' in app.extensions:
oauth = app.extensions['oauthlib.client']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please store the oauth on self

self.oauth = app.extensions.get('oauthlib.client')
if self.oauth is None:
    self.oauth = FlaskOAuth()  # NOTE no `app` argument as we are calling `init_app` later

# Add remote applications
self.oauth.init_app(app)

@JavierDelgadoFernandez JavierDelgadoFernandez force-pushed the flask_oauth_initialise branch 2 times, most recently from d95f762 to 337c48a Compare December 4, 2015 08:27
@jirikuncar
Copy link
Member

@JavierDelgadoFernandez please wait for #25 to be merged first and then rebase. Thanks

@@ -46,21 +47,23 @@ def __init__(self, app):
# Connect signal to remove access tokens on logout
user_logged_out.connect(oauth_logout_handler)

oauth = app.extensions['oauthlib.client']
self.oauth = app.extensions.get('oauthlib.client')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.oauth = app.extensions.get('oauthlib.client') or FlaskOAuth()?

@JavierDelgadoFernandez
Copy link
Contributor Author

@jirikuncar Rebased.

@jirikuncar
Copy link
Member

@JavierDelgadoFernandez please run kwalitee check message first.

* Fixes the initialization of the extension when there is no
  oauthlib.client object in extensions.

Signed-off-by: Javier Delgado <javier.delgado.fernandez@cern.ch>
@JavierDelgadoFernandez
Copy link
Contributor Author

@jirikuncar Sorry, done.

@jirikuncar jirikuncar merged commit 357b1f6 into inveniosoftware:master Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants