Skip to content

Commit

Permalink
Merge branch '2.13' of https://github.com/gweis/Zope into gweis-2.13
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver committed Feb 29, 2016
2 parents 114bf40 + f4c5d35 commit 3062452
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ZPublisher/WSGIPublisher.py
Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions src/ZPublisher/tests/test_WSGIPublisher.py
Expand Up @@ -447,6 +447,31 @@ def next(self):
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()
Expand Down

0 comments on commit 3062452

Please sign in to comment.