diff --git a/ordr2/templates/404.jinja2 b/ordr2/templates/404.jinja2 deleted file mode 100644 index 1917f83..0000000 --- a/ordr2/templates/404.jinja2 +++ /dev/null @@ -1,8 +0,0 @@ -{% extends "layout.jinja2" %} - -{% block content %} -
-

Pyramid Alchemy scaffold

-

404 Page Not Found

-
-{% endblock content %} diff --git a/ordr2/templates/errors/forbidden.jinja2 b/ordr2/templates/errors/forbidden.jinja2 new file mode 100644 index 0000000..d221f77 --- /dev/null +++ b/ordr2/templates/errors/forbidden.jinja2 @@ -0,0 +1,18 @@ +{% extends "ordr2:templates/layout.jinja2" %} + +{% block subtitle %} Access Denied {% endblock subtitle %} + +{% block content %} +
+
+ +
+
+

Access Denied!!!

+

You do not have the permission to access this page.

+
+
+ +
+
+{% endblock content %} diff --git a/ordr2/templates/errors/not_found.jinja2 b/ordr2/templates/errors/not_found.jinja2 new file mode 100644 index 0000000..0beb0b2 --- /dev/null +++ b/ordr2/templates/errors/not_found.jinja2 @@ -0,0 +1,18 @@ +{% extends "ordr2:templates/layout.jinja2" %} + +{% block subtitle %} Not Found {% endblock subtitle %} + +{% block content %} +
+
+ +
+
+

These are not the droids
you are looking for

+

Whatever you wanted to see was not found on this server.

+
+
+ +
+
+{% endblock content %} diff --git a/ordr2/views/errors.py b/ordr2/views/errors.py new file mode 100644 index 0000000..448ce52 --- /dev/null +++ b/ordr2/views/errors.py @@ -0,0 +1,18 @@ +from pyramid.view import ( + notfound_view_config, + forbidden_view_config + ) + + +@notfound_view_config(renderer='ordr2:templates/errors/not_found.jinja2') +def notfound_view(context, request): + context.nav_highlight = 'errors' + request.response.status = 404 + return {} + + +@forbidden_view_config(renderer='ordr2:templates/errors/forbidden.jinja2') +def forbidden_view(context, request): + request.response.status = 403 + context.nav_highlight = 'errors' + return {} diff --git a/ordr2/views/notfound.py b/ordr2/views/notfound.py deleted file mode 100644 index 9798e0c..0000000 --- a/ordr2/views/notfound.py +++ /dev/null @@ -1,7 +0,0 @@ -from pyramid.view import notfound_view_config - - -@notfound_view_config(renderer='../templates/404.jinja2') -def notfound_view(context, request): - request.response.status = 404 - return {}