summaryrefslogtreecommitdiff
path: root/paste/httpexceptions.py
diff options
context:
space:
mode:
authorcce <devnull@localhost>2006-01-03 02:17:28 +0000
committercce <devnull@localhost>2006-01-03 02:17:28 +0000
commit436cf9d49f2bd4e304bc820fe4aeaf17bba1f25e (patch)
tree8c03fcf89831afc382632b5646773aa92b77b15b /paste/httpexceptions.py
parentc950ee5341075bd9f6a6f9635614a79f7115207b (diff)
downloadpaste-436cf9d49f2bd4e304bc820fe4aeaf17bba1f25e.tar.gz
Allow the httpexceptions to be 'themeable'
Diffstat (limited to 'paste/httpexceptions.py')
-rw-r--r--paste/httpexceptions.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/paste/httpexceptions.py b/paste/httpexceptions.py
index dd4e260..0e26339 100644
--- a/paste/httpexceptions.py
+++ b/paste/httpexceptions.py
@@ -77,6 +77,17 @@ from response import has_header, header_value
from util.quoting import strip_html, html_quote
SERVER_NAME = 'WSGI Server'
+TEMPLATE = """\
+<html>\r
+ <head><title>%(title)s</title></head>\r
+ <body>\r
+ <h1>%(title)s</h1>\r
+ <p>%(body)s</p>\r
+ <hr noshade>\r
+ <div align="right">%(server)s</div>\r
+ </body>\r
+</html>\r
+"""
class HTTPException(Exception):
"""
@@ -202,17 +213,11 @@ class HTTPException(Exception):
def html(self, environ):
""" text/html representation of the exception """
body = self.make_body(environ, self.template, html_quote)
- return ('<html><head><title>%(title)s</title></head>\r\n'
- '<body>\r\n'
- '<h1>%(title)s</h1>\r\n'
- '<p>%(body)s</p>\r\n'
- '<hr noshade>\r\n'
- '<div align="right">%(server)s</div>\r\n'
- '</body></html>\r\n'
- % {'title': self.title,
+ return TEMPLATE % {
+ 'title': self.title,
'code': self.code,
'server': SERVER_NAME,
- 'body': body})
+ 'body': body }
def wsgi_application(self, environ, start_response, exc_info=None):
"""