aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-04-08 12:33:32 -0700
committerBryan Newbold <bnewbold@archive.org>2020-04-08 12:33:35 -0700
commit83e8d8a3fb5634fa68311be9c187cee19056f20e (patch)
tree6e2a80a013e4cecc9ff8390542d0a79bc4493d6d
parent42b922d4a395e8f2933da57968d467198add8fe9 (diff)
downloadfatcat-covid19-83e8d8a3fb5634fa68311be9c187cee19056f20e.tar.gz
fatcat-covid19-83e8d8a3fb5634fa68311be9c187cee19056f20e.zip
webface: disable 404, 5xx custom error pages
These break with 'lang_code' errors in our translation setup, I think because in this context we don't yet know what the language is. A work-around might be to manually set the language in the error handler function.
-rw-r--r--fatcat_covid19/webface.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/fatcat_covid19/webface.py b/fatcat_covid19/webface.py
index 7c02301..eb7d4c0 100644
--- a/fatcat_covid19/webface.py
+++ b/fatcat_covid19/webface.py
@@ -99,22 +99,22 @@ def page_about():
def page_sources():
return render_template('sources_{}.html'.format(g.lang_code))
-
-@bp.app_errorhandler(404)
-def page_not_found(e):
- return render_template('404.html'), 404
+# TODO: how to translate these pages? lang_code issue
+#@bp.app_errorhandler(404)
+#def page_not_found(e):
+# return render_template('404.html'), 404
+
+#@bp.app_errorhandler(502)
+#@bp.app_errorhandler(503)
+#@bp.app_errorhandler(504)
+#@bp.app_errorhandler(500)
+#def page_server_error(e):
+# return render_template('500.html'), 500
@bp.app_errorhandler(400)
def page_bad_request(e):
return render_template('400.html'), 400
-@bp.app_errorhandler(502)
-@bp.app_errorhandler(503)
-@bp.app_errorhandler(504)
-@bp.app_errorhandler(500)
-def page_server_error(e):
- return render_template('500.html'), 500
-
@app.route('/robots.txt', methods=['GET'])
def robots():
return send_from_directory(os.path.join(app.root_path, 'static'),