diff options
author | cce <devnull@localhost> | 2006-09-11 18:45:41 +0000 |
---|---|---|
committer | cce <devnull@localhost> | 2006-09-11 18:45:41 +0000 |
commit | 37ffd040dfd7cc97ed6235156ca264d1b68be010 (patch) | |
tree | 7c037ffcaeb2801faa7ed5e2edb6d1df3042afca /paste/httpexceptions.py | |
parent | f2d7c1d593393e9e9fdfddfe94d3162839e49337 (diff) | |
download | paste-37ffd040dfd7cc97ed6235156ca264d1b68be010.tar.gz |
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.
Diffstat (limited to 'paste/httpexceptions.py')
-rw-r--r-- | paste/httpexceptions.py | 6 |
1 files changed, 4 insertions, 2 deletions
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 |