From 7aa19b92f0e7808a341aec8ae17485408dfae68c Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 25 May 2021 16:30:09 -0700 Subject: small python lint fixes (no behavior change) --- python/fatcat_web/auth.py | 2 +- python/fatcat_web/routes.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'python/fatcat_web') diff --git a/python/fatcat_web/auth.py b/python/fatcat_web/auth.py index 74b8e2d6..a1ba1929 100644 --- a/python/fatcat_web/auth.py +++ b/python/fatcat_web/auth.py @@ -104,7 +104,7 @@ def handle_ia_xauth(email, password): if resp.status_code == 401 or (not resp.json().get('success')): try: flash("Internet Archive email/password didn't match: {}".format(resp.json()['values']['reason'])) - except: + except Exception: app.log.warning("IA XAuth fail: {}".format(resp.content)) return render_template('auth_ia_login.html', email=email), resp.status_code elif resp.status_code != 200: diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py index 7cf1f854..1a573006 100644 --- a/python/fatcat_web/routes.py +++ b/python/fatcat_web/routes.py @@ -658,7 +658,7 @@ def release_save(ident): Config.KAFKA_SAVEPAPERNOW_TOPIC, json.dumps(msg, sort_keys=True), ) - except: + except Exception: return render_template('release_save.html', entity=release, form=form, spn_status='kafka-error'), 500 return render_template('release_save.html', entity=release, form=form, spn_status='success'), 200 elif form.errors: -- cgit v1.2.3 From 4e89e677f03fbedb48f3f0dc6b23e159b5e33e27 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 25 May 2021 16:31:22 -0700 Subject: skip pylint on 'assigning-non-slot' warnings in Flask 2.0 The 'permanent' field is still valid to set to a boolean in Flask 2.0; not sure why pylint is unhappy in CI (causing test failures). Don't see any problem running test suite locally. Flask API docs: https://flask.palletsprojects.com/en/2.0.x/api/?highlight=permanent#flask.session.permanent And code (recent master branch): https://github.com/pallets/flask/blob/4240ace59710d86c478111affd4ad6fb4c8cad9e/src/flask/sessions.py#L20 --- python/fatcat_web/auth.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'python/fatcat_web') diff --git a/python/fatcat_web/auth.py b/python/fatcat_web/auth.py index a1ba1929..73869544 100644 --- a/python/fatcat_web/auth.py +++ b/python/fatcat_web/auth.py @@ -36,7 +36,7 @@ def handle_token_login(token): abort(400) # fetch editor info editor = api.get_editor(editor_id) - session.permanent = True + session.permanent = True # pylint: disable=assigning-non-slot session['api_token'] = token session['editor'] = editor.to_dict() login_user(load_user(editor.editor_id)) @@ -76,7 +76,7 @@ def handle_oauth(remote, token, user_info): api_token = resp.token # write token and username to session - session.permanent = True + session.permanent = True # pylint: disable=assigning-non-slot session['api_token'] = api_token session['editor'] = editor.to_dict() -- cgit v1.2.3