From 436cf9d49f2bd4e304bc820fe4aeaf17bba1f25e Mon Sep 17 00:00:00 2001 From: cce Date: Tue, 3 Jan 2006 02:17:28 +0000 Subject: Allow the httpexceptions to be 'themeable' --- paste/httpexceptions.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'paste/httpexceptions.py') 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 = """\ +\r + %(title)s\r + \r +

%(title)s

\r +

%(body)s

\r +
\r +
%(server)s
\r + \r +\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 ('%(title)s\r\n' - '\r\n' - '

%(title)s

\r\n' - '

%(body)s

\r\n' - '
\r\n' - '
%(server)s
\r\n' - '\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): """ -- cgit v1.2.1