]> git.ipfire.org Git - pbs.git/commitdiff
errors: Move error page templates to their own directory.
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 12 Dec 2012 13:46:32 +0000 (14:46 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 12 Dec 2012 13:46:32 +0000 (14:46 +0100)
Also add a nicer message for 400 - bad request.

data/templates/errors/error-400.html [new file with mode: 0644]
data/templates/errors/error-403.html [moved from data/templates/error-403.html with 91% similarity]
data/templates/errors/error-404.html [moved from data/templates/error-404.html with 100% similarity]
data/templates/errors/error.html [moved from data/templates/error.html with 97% similarity]
web/handlers_base.py

diff --git a/data/templates/errors/error-400.html b/data/templates/errors/error-400.html
new file mode 100644 (file)
index 0000000..f8bfaa2
--- /dev/null
@@ -0,0 +1,17 @@
+{% extends "error.html" %}
+
+{% block bigbox_headline %}
+       {{ _("400 - Bad request") }}
+{% end block %}
+
+{% block bigbox_subtitle %}
+       <small>{{ _("Invalid data has been passed to the application.") }}</small>
+{% end block %}
+
+{% block explanation %}
+       <p>
+               {{ _("The application refused to go on with the provided data that was sent in this request.") }}
+       </p>
+{% end block %}
+
+{% block message %}{% end block %}
similarity index 91%
rename from data/templates/error-403.html
rename to data/templates/errors/error-403.html
index 9a55b55eb6858319d67a4fee401e14c456c64893..a2bf15aa86ce3a533258844f36b25445ad172b33 100644 (file)
@@ -1,7 +1,7 @@
 {% extends "error.html" %}
 
 {% block bigbox_headline %}
-       {{ _("Access forbidden") }}
+       {{ _("403 - Access forbidden") }}
 {% end block %}
 
 {% block bigbox_subtitle %}
similarity index 97%
rename from data/templates/error.html
rename to data/templates/errors/error.html
index 2c7e2f620ac0f38d7db0e755250fff3dbd814b17..7d7232b4f2d477b2f0d8247a19835d8b9cf0aed9 100644 (file)
@@ -1,4 +1,4 @@
-{% extends "base.html" %}
+{% extends "../base.html" %}
 
 {% block body %}
        <div class="hero-unit">
index b2d7f768d6f9785d8afe687aa7f2e71d88deda1d..e72423cf0de358d2394220e62af5b429012ce4d3 100644 (file)
@@ -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: