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:
parent
04e9752ee1
commit
7463d4e092
25
tailbone/templates/exception.mako
Normal file
25
tailbone/templates/exception.mako
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
## -*- coding: utf-8 -*-
|
||||||
|
## TODO: this should leverage the underlying base template somehow..yes?
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||||
|
<title>${project_title} » Error!</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
An unexpected error has occurred in ${project_title}.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
But don't worry...details of the error have been emailed to the sysadmins, so we're on it!
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
In the meantime, you might try once or twice again, whatever it was you were just doing.
|
||||||
|
Occasionally certain errors will go away on their own. But if the problem persists, please
|
||||||
|
do NOT keep trying, because the sysadmins will get a new email for each error. :)
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -68,6 +68,12 @@ class CommonView(View):
|
||||||
"""
|
"""
|
||||||
return self.home(mobile=True)
|
return self.home(mobile=True)
|
||||||
|
|
||||||
|
def exception(self):
|
||||||
|
"""
|
||||||
|
Generic exception view
|
||||||
|
"""
|
||||||
|
return {'project_title': self.project_title}
|
||||||
|
|
||||||
def about(self):
|
def about(self):
|
||||||
"""
|
"""
|
||||||
Generic view to show "about project" info page.
|
Generic view to show "about project" info page.
|
||||||
|
@ -115,6 +121,9 @@ class CommonView(View):
|
||||||
# auto-correct URLs which require trailing slash
|
# auto-correct URLs which require trailing slash
|
||||||
config.add_notfound_view(cls, attr='notfound', append_slash=True)
|
config.add_notfound_view(cls, attr='notfound', append_slash=True)
|
||||||
|
|
||||||
|
# exception
|
||||||
|
config.add_exception_view(cls, attr='exception', renderer='/exception.mako')
|
||||||
|
|
||||||
# home
|
# home
|
||||||
config.add_route('home', '/')
|
config.add_route('home', '/')
|
||||||
config.add_view(cls, attr='home', route_name='home', renderer='/home.mako')
|
config.add_view(cls, attr='home', route_name='home', renderer='/home.mako')
|
||||||
|
|
Loading…
Reference in a new issue