Commit dcd81ee7 authored by Gerhard Weis's avatar Gerhard Weis

check most specific interface first (IStreamIterator before IUnboundStreamIterator)

parent 92474cca
......@@ -137,12 +137,12 @@ class WSGIResponse(HTTPResponse):
body.seek(0)
self.setHeader('Content-Length', '%d' % length)
self.body = body
elif IUnboundStreamIterator.providedBy(body):
elif IStreamIterator.providedBy(body):
self.body = body
self._streaming = 1
HTTPResponse.setBody(self, '', title, is_error)
elif IStreamIterator.providedBy(body):
elif IUnboundStreamIterator.providedBy(body):
self.body = body
self._streaming = 1
HTTPResponse.setBody(self, '', title, is_error)
else:
HTTPResponse.setBody(self, body, title, is_error)
......
......@@ -157,6 +157,7 @@ class WSGIResponseTests(unittest.TestCase):
response.setBody(body)
response.finalize()
self.assertTrue(body is response.body)
self.assertEqual(response._streaming, 1)
def test_setBody_IStreamIterator(self):
from ZPublisher.Iterators import IStreamIterator
......@@ -182,6 +183,7 @@ class WSGIResponseTests(unittest.TestCase):
response.setBody(body)
response.finalize()
self.assertTrue(body is response.body)
self.assertEqual(response._streaming, 0)
#def test___str__already_wrote_not_chunking(self):
# response = self._makeOne()
......
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