Skip to content

Commit

Permalink
wip: remove some flask warnings (to be tested)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonadoni committed Jul 9, 2024
1 parent 5b16a3b commit d0ccb17
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is part of REANA.
# Copyright (C) 2017, 2018, 2019, 2020, 2021, 2022, 2023 CERN.
# Copyright (C) 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand Down
25 changes: 11 additions & 14 deletions reana_server/ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@
from reana_commons.config import REANA_LOG_FORMAT, REANA_LOG_LEVEL
from werkzeug.exceptions import UnprocessableEntity

from invenio_oauthclient.signals import account_info_received
from flask_security.signals import user_registered

Check warning on line 20 in reana_server/ext.py

View check run for this annotation

Codecov / codecov/patch

reana_server/ext.py#L19-L20

Added lines #L19 - L20 were not covered by tests


from reana_server import config
from reana_server.utils import (

Check warning on line 24 in reana_server/ext.py

View check run for this annotation

Codecov / codecov/patch

reana_server/ext.py#L24

Added line #L24 was not covered by tests
_create_and_associate_local_user,
_create_and_associate_oauth_user,
)


def handle_rate_limit_error(error: RateLimitExceeded):
Expand Down Expand Up @@ -75,6 +83,9 @@ def init_app(self, app):
self.init_config(app)
self.init_error_handlers(app)

account_info_received.connect(_create_and_associate_oauth_user)
user_registered.connect(_create_and_associate_local_user)

Check warning on line 87 in reana_server/ext.py

View check run for this annotation

Codecov / codecov/patch

reana_server/ext.py#L86-L87

Added lines #L86 - L87 were not covered by tests

@app.teardown_appcontext
def shutdown_reana_db_session(response_or_exc):
"""Close session on app teardown."""
Expand All @@ -85,20 +96,6 @@ def shutdown_reana_db_session(response_or_exc):
invenio_db.session.remove()
return response_or_exc

@app.before_first_request
def connect_signals():
"""Connect OAuthClient signals."""
from invenio_oauthclient.signals import account_info_received
from flask_security.signals import user_registered

from .utils import (
_create_and_associate_local_user,
_create_and_associate_oauth_user,
)

account_info_received.connect(_create_and_associate_oauth_user)
user_registered.connect(_create_and_associate_local_user)

def init_config(self, app):
"""Initialize configuration."""
for k in dir(config):
Expand Down

0 comments on commit d0ccb17

Please sign in to comment.