diff options
author | cce <devnull@localhost> | 2006-01-03 02:17:28 +0000 |
---|---|---|
committer | cce <devnull@localhost> | 2006-01-03 02:17:28 +0000 |
commit | 436cf9d49f2bd4e304bc820fe4aeaf17bba1f25e (patch) | |
tree | 8c03fcf89831afc382632b5646773aa92b77b15b /paste/httpexceptions.py | |
parent | c950ee5341075bd9f6a6f9635614a79f7115207b (diff) | |
download | paste-436cf9d49f2bd4e304bc820fe4aeaf17bba1f25e.tar.gz |
Allow the httpexceptions to be 'themeable'
Diffstat (limited to 'paste/httpexceptions.py')
-rw-r--r-- | paste/httpexceptions.py | 23 |
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): """ |