Add default view for unhandled exceptions

to give the user a bit of low-down as to what should happen next...
This commit is contained in:
Lance Edgar 2017-03-28 00:00:35 -05:00
parent 04e9752ee1
commit 7463d4e092
2 changed files with 34 additions and 0 deletions

View file

@ -68,6 +68,12 @@ class CommonView(View):
"""
return self.home(mobile=True)
def exception(self):
"""
Generic exception view
"""
return {'project_title': self.project_title}
def about(self):
"""
Generic view to show "about project" info page.
@ -115,6 +121,9 @@ class CommonView(View):
# auto-correct URLs which require trailing slash
config.add_notfound_view(cls, attr='notfound', append_slash=True)
# exception
config.add_exception_view(cls, attr='exception', renderer='/exception.mako')
# home
config.add_route('home', '/')
config.add_view(cls, attr='home', route_name='home', renderer='/home.mako')