summaryrefslogtreecommitdiff
path: root/paste/wsgilib.py
diff options
context:
space:
mode:
authorpjenvey <devnull@localhost>2006-08-11 03:56:27 +0000
committerpjenvey <devnull@localhost>2006-08-11 03:56:27 +0000
commite76fe7ce0a94bfe6356fe2af259a75fc0790a3fd (patch)
tree6cfa76a207937014255c7b91067b40c59af61369 /paste/wsgilib.py
parent77db999f1cdd6054708ebe163532fb4e724eac12 (diff)
downloadpaste-e76fe7ce0a94bfe6356fe2af259a75fc0790a3fd.tar.gz
o catch_errors_app and _wrap_app_iter_app were not in sync with the
exception catch_errors_app was specified to catch, causing the wrapper to consume all exceptions o avoid allowing _wrap_app_iter_app to close() its wrapped iter twice in certain situations
Diffstat (limited to 'paste/wsgilib.py')
-rw-r--r--paste/wsgilib.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/paste/wsgilib.py b/paste/wsgilib.py
index 97ce27f..7f72b89 100644
--- a/paste/wsgilib.py
+++ b/paste/wsgilib.py
@@ -215,18 +215,19 @@ def catch_errors_app(application, environ, start_response, error_callback_app,
else:
return _wrap_app_iter_app(
environ, start_response, app_iter,
- error_callback_app, ok_callback)
+ error_callback_app, ok_callback, catch=catch)
class _wrap_app_iter_app(object):
def __init__(self, environ, start_response, app_iterable,
- error_callback_app, ok_callback):
+ error_callback_app, ok_callback, catch=Exception):
self.environ = environ
self.start_response = start_response
self.app_iterable = app_iterable
self.app_iter = iter(app_iterable)
self.error_callback_app = error_callback_app
self.ok_callback = ok_callback
+ self.catch = catch
if hasattr(self.app_iterable, 'close'):
self.close = self.app_iterable.close
@@ -240,7 +241,7 @@ class _wrap_app_iter_app(object):
if self.ok_callback:
self.ok_callback()
raise
- except:
+ except self.catch:
if hasattr(self.app_iterable, 'close'):
try:
self.app_iterable.close()
@@ -252,6 +253,8 @@ class _wrap_app_iter_app(object):
app_iter = iter(new_app_iterable)
if hasattr(new_app_iterable, 'close'):
self.close = new_app_iterable.close
+ else:
+ del self.close
self.next = app_iter.next
return self.next()