diff options
author | ianb <devnull@localhost> | 2006-05-31 00:48:53 +0000 |
---|---|---|
committer | ianb <devnull@localhost> | 2006-05-31 00:48:53 +0000 |
commit | e010000a17c40a4c288a1aef9f94077adc6a223e (patch) | |
tree | 6b3f98629453dad672e43d07d87835f43af0935e /paste/wsgilib.py | |
parent | 064a4b61f09111be9d1c13624cf8bd08a39a9967 (diff) | |
download | paste-e010000a17c40a4c288a1aef9f94077adc6a223e.tar.gz |
Added a warning to paste.wsgilib.add_close
Diffstat (limited to 'paste/wsgilib.py')
-rw-r--r-- | paste/wsgilib.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/paste/wsgilib.py b/paste/wsgilib.py index d83799a..70b1bc4 100644 --- a/paste/wsgilib.py +++ b/paste/wsgilib.py @@ -40,6 +40,7 @@ class add_close: self.app_iterable = app_iterable self.app_iter = iter(app_iterable) self.close_func = close_func + self._closed = False def __iter__(self): return self @@ -48,10 +49,19 @@ class add_close: return self.app_iter.next() def close(self): + self._closed = True if hasattr(self.app_iterable, 'close'): self.app_iterable.close() self.close_func() + def __del__(self): + if not self._closed: + # We can't raise an error or anything at this stage + print >> sys.stderr, ( + "Error: app_iter.close() was not called when finishing " + "WSGI request. finalization function %s not called" + % self.close_func) + def catch_errors(application, environ, start_response, error_callback, ok_callback=None): """ |