aboutsummaryrefslogtreecommitdiffstats
path: root/beweb
diff options
context:
space:
mode:
authorAaron Bentley <abentley@panoramicfeedback.com>2005-12-23 12:40:43 -0500
committerAaron Bentley <abentley@panoramicfeedback.com>2005-12-23 12:40:43 -0500
commit0aeaf43cf857a027a4f9341655d6d67bf27789ec (patch)
treed2becd8c7dccec4dea40f6fb221ba5f2b78b9820 /beweb
parent75f83d38d09555a152317e2167cdd317a6ff5283 (diff)
downloadbugseverywhere-0aeaf43cf857a027a4f9341655d6d67bf27789ec.tar.gz
Added error handling and 'About' page
Diffstat (limited to 'beweb')
-rw-r--r--beweb/beweb/controllers.py34
-rw-r--r--beweb/beweb/static/css/style.css17
-rw-r--r--beweb/beweb/templates/about.kid20
-rw-r--r--beweb/beweb/templates/error.kid14
-rw-r--r--beweb/beweb/templates/master.kid4
5 files changed, 86 insertions, 3 deletions
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 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"
+ py:extends="'master.kid'">
+<head>
+ <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
+ <title>About Bugs Everywhere</title>
+</head>
+
+<body>
+<h1>About Bugs Everywhere</h1>
+<p>Bug Everywhere was designed by Aaron Bentley and implemented by Aaron
+ Bentley and Oleg Romanyshyn.
+</p>
+<p>
+ Some of its development was sponsored by
+ <a href="http://panoramicfeedback.com/">Panoramic Feedback</a>
+</p>
+<a href="/">Project List</a>
+</body>
+</html>
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 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"
+ py:extends="'master.kid'">
+<head>
+ <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
+ <title>BE Error: ${heading}</title>
+</head>
+
+<body>
+<h1 py:content="heading">Error heading</h1>
+<div py:replace="body" >Error Body</div>
+<pre py:content="traceback" class="traceback">Traceback</pre>
+</body>
+</html>
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 @@
</head>
<body py:match="item.tag=='{http://www.w3.org/1999/xhtml}body'">
-<div id="header">b u g s e v r y w h e r e</div>
+<div id="header"><div style="float: left">b u g s e v r y w h e r e</div><ul class="navoption"><li><a href="/about/">About</a></li></ul>&#160;</div>
<div py:if="tg_flash" class="flash" py:content="tg_flash"></div>
<div py:replace="item[:]"/>
</body>
-<table py:match="item.tag=='{http://www.w3.org/1999/xhtml}insetbox'" cellspacing="0" cellpadding="0" border="0" class="insetbox">
+<table py:match="item.tag=='{http://www.w3.org/1999/xhtml}insetbox'" ellspacing="0" cellpadding="0" border="0" class="insetbox">
<tr height="19"><td background="/static/images/is-tl.png" width="19"/>
<td background="/static/images/is-t.png" />
<td background="/static/images/is-tr.png" width="11"></td>