From 37ffd040dfd7cc97ed6235156ca264d1b68be010 Mon Sep 17 00:00:00 2001 From: cce Date: Mon, 11 Sep 2006 18:45:41 +0000 Subject: Adding HTTPException.detail_template class variable to permit specializations to wrap a detail with contextual information. This shouldn't change any existing behavior or APIs. --- paste/httpexceptions.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'paste') diff --git a/paste/httpexceptions.py b/paste/httpexceptions.py index 095fc9f..adfd5d3 100644 --- a/paste/httpexceptions.py +++ b/paste/httpexceptions.py @@ -166,6 +166,7 @@ class HTTPException(Exception): code = None title = None + detail_template = '%s' explanation = '' detail = '' comment = '' @@ -192,12 +193,13 @@ class HTTPException(Exception): if comment is not None: self.comment = comment Exception.__init__(self,"%s %s\n%s\n%s\n" % ( - self.code, self.title, self.explanation, self.detail)) + self.code, self.title, self.explanation, + self.detail_template % self.detail)) def make_body(self, environ, template, escfunc, comment_escfunc=None): comment_escfunc = comment_escfunc or escfunc args = {'explanation': escfunc(self.explanation), - 'detail': escfunc(self.detail), + 'detail': escfunc(self.detail_template % self.detail), 'comment': comment_escfunc(self.comment)} if HTTPException.template == self.template: return template % args -- cgit v1.2.1