Permalink
Browse files

Added suport for notfound view

  • Loading branch information...
1 parent ed0e10f commit c60adffcc6eedd8dee12b88c7597d83145bddb53 @blaflamme committed Mar 16, 2011
Showing with 20 additions and 1 deletion.
  1. +8 −1 static/style.css
  2. +5 −0 tasks.py
  3. +7 −0 templates/notfound.mako
View
@@ -32,7 +32,7 @@ input {
border-right: none;
}
-#flash {
+#flash, #notfound {
font-size: 16px;
width: 500px;
text-align: center;
@@ -42,6 +42,13 @@ input {
padding: 10px 20px 10px 20px;
}
+#notfound {
+ background-color: #fbe3e4;
+ border-top: 2px solid #fbc2c4;
+ border-bottom: 2px solid #fbc2c4;
+ padding: 0 20px 30px 20px;
+}
+
#tasks {
width: 500px;
}
View
@@ -5,6 +5,7 @@
from pyramid.events import NewRequest
from pyramid.events import subscriber
from pyramid.events import ApplicationCreated
+from pyramid.exceptions import NotFound
from pyramid.httpexceptions import HTTPFound
from pyramid.session import UnencryptedCookieSessionFactoryConfig
from pyramid.view import view_config
@@ -45,6 +46,10 @@ def close_view(request):
request.session.flash('Task was successfully closed!')
return HTTPFound(location=request.route_url('list'))
+@view_config(context='pyramid.exceptions.NotFound', renderer='notfound.mako')
+def notfound(self):
+ return {}
+
# subscribers
@subscriber(NewRequest)
def new_request_subscriber(event):
@@ -0,0 +1,7 @@
+# -*- coding: utf-8 -*-
+<%inherit file="layout.mako"/>
+
+<div id="notfound">
+ <h1>404 - PAGE NOT FOUND</h1>
+ The page you're looking for isn't here.
+</div>

0 comments on commit c60adff

Please sign in to comment.