summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Abramowitz <marc@marc-abramowitz.com>2016-03-07 13:29:21 -0800
committerMarc Abramowitz <marc@marc-abramowitz.com>2016-03-07 13:29:21 -0800
commitfc68f20d0fcb47a6cef39f9efc828c50d427a531 (patch)
tree0e11fa8c285f5114df688451ad0c647b3373175d
parent73f4e5479ff1d15892deabd3889bdac7cc85465a (diff)
downloadpaste-git-fc68f20d0fcb47a6cef39f9efc828c50d427a531.tar.gz
paste.wsgilib.add_close: Add __next__ method
to support using `add_close` objects as iterators on Python 3.
-rw-r--r--paste/wsgilib.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/paste/wsgilib.py b/paste/wsgilib.py
index 98299e2..116f47b 100644
--- a/paste/wsgilib.py
+++ b/paste/wsgilib.py
@@ -46,6 +46,10 @@ class add_close(object):
def next(self):
return self.app_iter.next()
+ # Python 3 uses __next__ instead of next
+ def __next__(self):
+ return bytes(next(self.app_iter), encoding='ascii')
+
def close(self):
self._closed = True
if hasattr(self.app_iterable, 'close'):