Commit 30624529 authored by Tres Seaver's avatar Tres Seaver

Merge branch '2.13' of https://github.com/gweis/Zope into gweis-2.13

parents 114bf40b f4c5d357
......@@ -282,7 +282,7 @@ def publish_module(environ, start_response,
body = response.body
if isinstance(body, file) or IStreamIterator.providedBy(body):
if isinstance(body, file) or IUnboundStreamIterator.providedBy(body):
result = body
else:
# If somebody used response.write, that data will be in the
......
......@@ -447,6 +447,31 @@ class Test_publish_module(unittest.TestCase):
app_iter = self._callFUT(environ, start_response, _publish)
self.assertTrue(app_iter is body)
def test_response_is_unboundstream(self):
from ZPublisher.Iterators import IUnboundStreamIterator
from zope.interface import implements
class test_unboundstreamiterator:
implements(IUnboundStreamIterator)
data = "hello"
done = 0
def next(self):
if not self.done:
self.done = 1
return self.data
raise StopIteration
_response = DummyResponse()
_response._status = '200 OK'
body = _response.body = test_unboundstreamiterator()
environ = self._makeEnviron()
start_response = DummyCallable()
_publish = DummyCallable()
_publish._result = _response
app_iter = self._callFUT(environ, start_response, _publish)
self.assertTrue(app_iter is body)
def test_request_closed_when_tm_middleware_not_active(self):
environ = self._makeEnviron()
start_response = DummyCallable()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment