summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xipsilon/root.py1
-rwxr-xr-xipsilon/util/errors.py7
-rwxr-xr-xipsilon/util/page.py2
-rw-r--r--templates/notfound.html13
4 files changed, 22 insertions, 1 deletions
diff --git a/ipsilon/root.py b/ipsilon/root.py
index 0046ddf..b2654ac 100755
--- a/ipsilon/root.py
+++ b/ipsilon/root.py
@@ -43,6 +43,7 @@ class Root(Page):
# set up error pages
cherrypy.config['error_page.400'] = errors.Error_400(self._site)
cherrypy.config['error_page.401'] = errors.Error_401(self._site)
+ cherrypy.config['error_page.404'] = errors.Error_404(self._site)
cherrypy.config['error_page.500'] = errors.Errors(self._site)
# now set up the default login plugins
diff --git a/ipsilon/util/errors.py b/ipsilon/util/errors.py
index 3d7ea28..2f3cc3d 100755
--- a/ipsilon/util/errors.py
+++ b/ipsilon/util/errors.py
@@ -54,3 +54,10 @@ class Error_401(Errors):
def handler(self, status, message, traceback, version):
return self._error_template('unauthorized.html',
title='Unauthorized', message=message)
+
+
+class Error_404(Errors):
+
+ def handler(self, status, message, traceback, version):
+ return self._error_template('notfound.html',
+ title='Not Found', message=message)
diff --git a/ipsilon/util/page.py b/ipsilon/util/page.py
index 1548d47..a99d2f4 100755
--- a/ipsilon/util/page.py
+++ b/ipsilon/util/page.py
@@ -108,7 +108,7 @@ class Page(Log):
return t.render(**m)
def default(self, *args, **kwargs):
- raise cherrypy.HTTPError(404)
+ raise cherrypy.NotFound()
def add_subtree(self, name, page):
self.__dict__[name] = page
diff --git a/templates/notfound.html b/templates/notfound.html
new file mode 100644
index 0000000..71743b5
--- /dev/null
+++ b/templates/notfound.html
@@ -0,0 +1,13 @@
+{% extends "master.html" %}
+{% block main %}
+<div class="col-sm-12">
+ <h1>404 - Not Found</h1>
+ {% if message: %}
+ <p>{{ message }}</p>
+ {% else %}
+ <p>This page does not exist.</p>
+ {% endif %}
+ <p>If you think this is an error, contact the server administrator to
+ resolve the problem.</p>
+</div>
+{% endblock %}