From: Aaron Bentley Date: Fri, 23 Dec 2005 17:40:43 +0000 (-0500) Subject: Added error handling and 'About' page X-Git-Tag: 1.0.0~244 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0aeaf43cf857a027a4f9341655d6d67bf27789ec;p=be.git Added error handling and 'About' page --- diff --git a/beweb/beweb/controllers.py b/beweb/beweb/controllers.py index 564c43b..b0f13db 100644 --- a/beweb/beweb/controllers.py +++ b/beweb/beweb/controllers.py @@ -1,7 +1,8 @@ import turbogears from turbogears import controllers import cherrypy -from libbe.bugdir import tree_root, cmp_severity, new_bug, new_comment +from libbe.bugdir import (tree_root, cmp_severity, new_bug, new_comment, + NoRootEntry) from libbe import names from config import projects from prest import PrestHandler, provide_action @@ -136,6 +137,37 @@ class Root(controllers.Root): @turbogears.expose() def index(self): raise cherrypy.HTTPRedirect(project_url()) + + @turbogears.expose('beweb.templates.about') + def about(self, *paths, **kwargs): + return {} + @turbogears.expose() def default(self, *args, **kwargs): return self.prest.default(*args, **kwargs) + + def _cpOnError(self): + import traceback, StringIO + bodyFile = StringIO.StringIO() + traceback.print_exc(file = bodyFile) + trace_text = bodyFile.getvalue() + try: + raise + except cherrypy.NotFound: + self.handle_error('Not Found', str(e), trace_text, '404 Not Found') + + except NoRootEntry, e: + self.handle_error('Project Misconfiguration', str(e), trace_text) + + except Exception, e: + self.handle_error('Internal server error', str(e), trace_text) + + def handle_error(self, heading, body, traceback=None, + status='500 Internal Server Error'): + cherrypy.response.headerMap['Status'] = status + cherrypy.response.body = [self.errorpage(heading, body, traceback)] + + + @turbogears.expose(html='beweb.templates.error') + def errorpage(self, heading, body, traceback): + return {'heading': heading, 'body': body, 'traceback': traceback} diff --git a/beweb/beweb/static/css/style.css b/beweb/beweb/static/css/style.css index 03c2ca4..160beff 100644 --- a/beweb/beweb/static/css/style.css +++ b/beweb/beweb/static/css/style.css @@ -71,6 +71,19 @@ body background-repeat: no-repeat; background-color: #ff0; } +#header ul.navoption +{ + display: block; + float: right; + margin: 0; + padding-right: 30px; +} +#header li +{ + display: inline; + margin:0; + padding:0; +} table.insetbox { margin-top: 0.5em; @@ -81,3 +94,7 @@ table.insetbox margin: 0; padding: 0; } +pre.traceback +{ + font-family: Verdana, Ariel, Helvetica, sanserif; +} diff --git a/beweb/beweb/templates/about.kid b/beweb/beweb/templates/about.kid new file mode 100644 index 0000000..93aad7a --- /dev/null +++ b/beweb/beweb/templates/about.kid @@ -0,0 +1,20 @@ + + + + + About Bugs Everywhere + + + +

About Bugs Everywhere

+

Bug Everywhere was designed by Aaron Bentley and implemented by Aaron + Bentley and Oleg Romanyshyn. +

+

+ Some of its development was sponsored by + Panoramic Feedback +

+Project List + + diff --git a/beweb/beweb/templates/error.kid b/beweb/beweb/templates/error.kid new file mode 100644 index 0000000..bc55615 --- /dev/null +++ b/beweb/beweb/templates/error.kid @@ -0,0 +1,14 @@ + + + + + BE Error: ${heading} + + + +

Error heading

+
Error Body
+
Traceback
+ + diff --git a/beweb/beweb/templates/master.kid b/beweb/beweb/templates/master.kid index f6f54b1..ea8f57a 100644 --- a/beweb/beweb/templates/master.kid +++ b/beweb/beweb/templates/master.kid @@ -10,12 +10,12 @@ - +
- +