summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-05-28 00:13:06 -0400
committerChris McDonough <chrism@plope.com>2011-05-28 00:13:06 -0400
commitf77703d25056236d027a1a61bf63fab3a7c1b2c2 (patch)
tree15c5cc443cad0e6cb74a2604c4b30e0e38439886
parent8c2a9e6d8d4f089222db7b30324774e94279b0e4 (diff)
downloadpyramid-f77703d25056236d027a1a61bf63fab3a7c1b2c2.tar.gz
pyramid-f77703d25056236d027a1a61bf63fab3a7c1b2c2.tar.bz2
pyramid-f77703d25056236d027a1a61bf63fab3a7c1b2c2.zip
horrid workaround for no app_iter initialized
-rw-r--r--pyramid/exceptions.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/pyramid/exceptions.py b/pyramid/exceptions.py
index 60e3c7b9b..e9718c6ab 100644
--- a/pyramid/exceptions.py
+++ b/pyramid/exceptions.py
@@ -84,6 +84,12 @@ class HTTPNotFound(_HTTPNotFound):
_HTTPNotFound.__init__(self, detail=detail, headers=headers,
comment=comment, body_template=body_template,
**kw)
+ if not ('body' in kw or 'app_iter' in kw):
+ if not self.empty_body:
+ body = self.html_body(self.environ)
+ if isinstance(body, unicode):
+ body = body.encode(self.charset)
+ self.body = body
class HTTPForbidden(_HTTPForbidden):
"""
@@ -114,6 +120,12 @@ class HTTPForbidden(_HTTPForbidden):
_HTTPForbidden.__init__(self, detail=detail, headers=headers,
comment=comment, body_template=body_template,
**kw)
+ if not ('body' in kw or 'app_iter' in kw):
+ if not self.empty_body:
+ body = self.html_body(self.environ)
+ if isinstance(body, unicode):
+ body = body.encode(self.charset)
+ self.body = body
NotFound = HTTPNotFound # bw compat
Forbidden = HTTPForbidden # bw compat