summaryrefslogtreecommitdiff
path: root/paste/evalexception
diff options
context:
space:
mode:
authorianb <devnull@localhost>2006-01-20 06:02:01 +0000
committerianb <devnull@localhost>2006-01-20 06:02:01 +0000
commit7664aaa6cce7b6f559e896d4de7c5f283b1d2a50 (patch)
treeb675ba8529d9dcb35fb92ffafb5b5fef5d86f83a /paste/evalexception
parentb75bcdff3a038d6e6089fe9af6ac82e788478fae (diff)
downloadpaste-7664aaa6cce7b6f559e896d4de7c5f283b1d2a50.tar.gz
Fix a problem with errors during the response iterator, and missing method
Diffstat (limited to 'paste/evalexception')
-rw-r--r--paste/evalexception/middleware.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/paste/evalexception/middleware.py b/paste/evalexception/middleware.py
index 83dc37b..1ad6df6 100644
--- a/paste/evalexception/middleware.py
+++ b/paste/evalexception/middleware.py
@@ -233,7 +233,12 @@ class EvalException(object):
try:
__traceback_supplement__ = errormiddleware.Supplement, self, environ
app_iter = self.application(environ, detect_start_response)
- return self.catching_iter(app_iter, environ)
+ try:
+ return_iter = list(app_iter)
+ return return_iter
+ finally:
+ if hasattr(app_iter, 'close'):
+ app_iter.close()
except:
exc_info = sys.exc_info()
for expected in environ.get('paste.expected_exceptions', []):
@@ -294,6 +299,18 @@ class EvalException(object):
% close_response)
yield response
+ def exception_handler(self, exc_info, environ):
+ simple_html_error = False
+ if self.xmlhttp_key:
+ get_vars = wsgilib.parse_querystring(environ)
+ if dict(get_vars).get(self.xmlhttp_key):
+ simple_html_error = True
+ return errormiddleware.handle_exception(
+ exc_info, environ['wsgi.errors'],
+ html=True,
+ debug_mode=True,
+ simple_html_error=simple_html_error)
+
def eval_javascript(self, base_path, counter):
base_path += '/_debug'
return (