Loading CHANGELOG +3 −0 Changes for CHANGELOG: 3 added lines, 0 removed lines. Original line number Diff line number Diff line V 0.17.0: - Introduced custom HTTP error pages - Fixed issues with updating match data V 0.16.5: - Fixed issues with updating match data V 0.16.4: Loading bundesliga_tippspiel/__init__.py +3 −0 Changes for bundesliga_tippspiel/__init__.py: 3 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -36,6 +36,9 @@ login_manager = LoginManager(app) """ The Flask-Login Login Manager """ # Config app.config["TRAP_HTTP_EXCEPTIONS"] = True login_manager.session_protection = "strong" Loading bundesliga_tippspiel/routes/__init__.py +1 −1 Changes for bundesliga_tippspiel/routes/__init__.py: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -36,6 +36,6 @@ def load_routes(): # noinspection PyUnresolvedReferences import bundesliga_tippspiel.routes.information # noinspection PyUnresolvedReferences # import bundesliga_tippspiel.routes.errors import bundesliga_tippspiel.routes.errors load_api_routes() bundesliga_tippspiel/routes/errors.py +19 −14 Changes for bundesliga_tippspiel/routes/errors.py: 19 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -17,19 +17,24 @@ You should have received a copy of the GNU General Public License along with bundesliga-tippspiel. If not, see <http://www.gnu.org/licenses/>. LICENSE""" # from flask import redirect, url_for, flash # from bundesliga_tippspiel import app # from bundesliga_tippspiel.types.enums import AlertSeverity from flask import redirect, url_for, flash, render_template from werkzeug.exceptions import HTTPException from bundesliga_tippspiel import app from bundesliga_tippspiel.types.enums import AlertSeverity # @app.errorhandler(401) # def unauthorized(_): # """ # Custom redirect for 401 errors # :return: A redirect to the login page # """ # flash( # "Du bist nicht angemeldet. Bitte melde dich an.", # AlertSeverity.DANGER.value # ) # return redirect(url_for("login")) @app.errorhandler(HTTPException) def error_handling(error: HTTPException): """ Custom redirect for 401 errors :param error: The error that caused the error handler to be called :return: A redirect to the login page """ if error.code == 401: flash( "Du bist nicht angemeldet. Bitte melde dich an.", AlertSeverity.DANGER.value ) return redirect(url_for("login")) else: return render_template("static/error_page.html", error=error) bundesliga_tippspiel/templates/static/error_page.html 0 → 100644 +24 −0 Changes for bundesliga_tippspiel/templates/static/error_page.html: 24 added lines, 0 removed lines. Original line number Diff line number Diff line {# Copyright 2017 Hermann Krumrey <hermann@krumreyh.com> This file is part of bundesliga-tippspiel. bundesliga-tippspiel is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. bundesliga-tippspiel is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with bundesliga-tippspiel. If not, see <http://www.gnu.org/licenses/>. #} {% extends "components/base_layout.html" %} {% block body %} <h1>Error {{ error.code }}</h1> <h3>{{ error.description }}</h3> {% endblock %} Loading
CHANGELOG +3 −0 Changes for CHANGELOG: 3 added lines, 0 removed lines. Original line number Diff line number Diff line V 0.17.0: - Introduced custom HTTP error pages - Fixed issues with updating match data V 0.16.5: - Fixed issues with updating match data V 0.16.4: Loading
bundesliga_tippspiel/__init__.py +3 −0 Changes for bundesliga_tippspiel/__init__.py: 3 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -36,6 +36,9 @@ login_manager = LoginManager(app) """ The Flask-Login Login Manager """ # Config app.config["TRAP_HTTP_EXCEPTIONS"] = True login_manager.session_protection = "strong" Loading
bundesliga_tippspiel/routes/__init__.py +1 −1 Changes for bundesliga_tippspiel/routes/__init__.py: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -36,6 +36,6 @@ def load_routes(): # noinspection PyUnresolvedReferences import bundesliga_tippspiel.routes.information # noinspection PyUnresolvedReferences # import bundesliga_tippspiel.routes.errors import bundesliga_tippspiel.routes.errors load_api_routes()
bundesliga_tippspiel/routes/errors.py +19 −14 Changes for bundesliga_tippspiel/routes/errors.py: 19 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -17,19 +17,24 @@ You should have received a copy of the GNU General Public License along with bundesliga-tippspiel. If not, see <http://www.gnu.org/licenses/>. LICENSE""" # from flask import redirect, url_for, flash # from bundesliga_tippspiel import app # from bundesliga_tippspiel.types.enums import AlertSeverity from flask import redirect, url_for, flash, render_template from werkzeug.exceptions import HTTPException from bundesliga_tippspiel import app from bundesliga_tippspiel.types.enums import AlertSeverity # @app.errorhandler(401) # def unauthorized(_): # """ # Custom redirect for 401 errors # :return: A redirect to the login page # """ # flash( # "Du bist nicht angemeldet. Bitte melde dich an.", # AlertSeverity.DANGER.value # ) # return redirect(url_for("login")) @app.errorhandler(HTTPException) def error_handling(error: HTTPException): """ Custom redirect for 401 errors :param error: The error that caused the error handler to be called :return: A redirect to the login page """ if error.code == 401: flash( "Du bist nicht angemeldet. Bitte melde dich an.", AlertSeverity.DANGER.value ) return redirect(url_for("login")) else: return render_template("static/error_page.html", error=error)
bundesliga_tippspiel/templates/static/error_page.html 0 → 100644 +24 −0 Changes for bundesliga_tippspiel/templates/static/error_page.html: 24 added lines, 0 removed lines. Original line number Diff line number Diff line {# Copyright 2017 Hermann Krumrey <hermann@krumreyh.com> This file is part of bundesliga-tippspiel. bundesliga-tippspiel is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. bundesliga-tippspiel is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with bundesliga-tippspiel. If not, see <http://www.gnu.org/licenses/>. #} {% extends "components/base_layout.html" %} {% block body %} <h1>Error {{ error.code }}</h1> <h3>{{ error.description }}</h3> {% endblock %}