From f4759c603fc931547be1ea03b41751747d02b148 Mon Sep 17 00:00:00 2001 From: Robin Winslow Date: Fri, 11 Mar 2022 16:57:27 +0000 Subject: [PATCH 1/2] Pass through error messages from flask.abort to 404.html and 500.html templates --- canonicalwebteam/flask_base/app.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/canonicalwebteam/flask_base/app.py b/canonicalwebteam/flask_base/app.py index 0b5c6a1..b909cda 100644 --- a/canonicalwebteam/flask_base/app.py +++ b/canonicalwebteam/flask_base/app.py @@ -232,13 +232,23 @@ def __init__( @self.errorhandler(404) def not_found_error(error): - return flask.render_template(template_404), 404 + return ( + flask.render_template( + template_404, message=error.description + ), + 404, + ) if template_500: @self.errorhandler(500) def internal_error(error): - return flask.render_template(template_500), 500 + return ( + flask.render_template( + template_500, message=error.description + ), + 500, + ) # Default routes @self.route("/fish") From 3679bd733ba76adbe7aa3693fbea4eaea748be4d Mon Sep 17 00:00:00 2001 From: Robin Winslow Date: Fri, 11 Mar 2022 16:58:48 +0000 Subject: [PATCH 2/2] v1.0.2 --- CHANGELOG.md | 4 ++++ setup.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a3ccb6..646ef8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.0.2 (2022-03-21) + +Pass through error messages from flask.abort to 404.html and 500.html templates + # 1.0.1 (2022-02-21) Fix dependencies for Flask 1.1.x: markupsafe and itsdangerous. diff --git a/setup.py b/setup.py index 14210b9..1b8d902 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup( name="canonicalwebteam.flask-base", - version="1.0.1", + version="1.0.2", description=( "Flask extension that applies common configurations" "to all of webteam's flask apps."