From: Michael Tremer Date: Wed, 12 Dec 2012 13:46:32 +0000 (+0100) Subject: errors: Move error page templates to their own directory. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae4c835ae24c810fa5f1503ad4eb0ba14efba842;p=pbs.git errors: Move error page templates to their own directory. Also add a nicer message for 400 - bad request. --- diff --git a/data/templates/errors/error-400.html b/data/templates/errors/error-400.html new file mode 100644 index 00000000..f8bfaa2b --- /dev/null +++ b/data/templates/errors/error-400.html @@ -0,0 +1,17 @@ +{% extends "error.html" %} + +{% block bigbox_headline %} + {{ _("400 - Bad request") }} +{% end block %} + +{% block bigbox_subtitle %} + {{ _("Invalid data has been passed to the application.") }} +{% end block %} + +{% block explanation %} +

+ {{ _("The application refused to go on with the provided data that was sent in this request.") }} +

+{% end block %} + +{% block message %}{% end block %} diff --git a/data/templates/error-403.html b/data/templates/errors/error-403.html similarity index 91% rename from data/templates/error-403.html rename to data/templates/errors/error-403.html index 9a55b55e..a2bf15aa 100644 --- a/data/templates/error-403.html +++ b/data/templates/errors/error-403.html @@ -1,7 +1,7 @@ {% extends "error.html" %} {% block bigbox_headline %} - {{ _("Access forbidden") }} + {{ _("403 - Access forbidden") }} {% end block %} {% block bigbox_subtitle %} diff --git a/data/templates/error-404.html b/data/templates/errors/error-404.html similarity index 100% rename from data/templates/error-404.html rename to data/templates/errors/error-404.html diff --git a/data/templates/error.html b/data/templates/errors/error.html similarity index 97% rename from data/templates/error.html rename to data/templates/errors/error.html index 2c7e2f62..7d7232b4 100644 --- a/data/templates/error.html +++ b/data/templates/errors/error.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "../base.html" %} {% block body %}
diff --git a/web/handlers_base.py b/web/handlers_base.py index b2d7f768..e72423cf 100644 --- a/web/handlers_base.py +++ b/web/handlers_base.py @@ -123,15 +123,15 @@ class BaseHandler(tornado.web.RequestHandler): return tornado.web.RequestHandler.render_string(self, *args, **kwargs) def get_error_html(self, status_code, exception=None, **kwargs): - error_document = "error.html" + error_document = "errors/error.html" kwargs.update({ "code" : status_code, "message" : httplib.responses[status_code], }) - if status_code in (403, 404): - error_document = "error-%s.html" % status_code + if status_code in (400, 403, 404): + error_document = "errors/error-%s.html" % status_code # Collect more information about the exception if possible. if exception: