Skip to content

Commit

Permalink
check most specific interface first (IStreamIterator before IUnboundS…
Browse files Browse the repository at this point in the history
…treamIterator)
  • Loading branch information
Gerhard Weis committed Aug 5, 2015
1 parent 92474cc commit dcd81ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ZPublisher/WSGIPublisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ def setBody(self, body, title='', is_error=0):
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)
Expand Down
2 changes: 2 additions & 0 deletions src/ZPublisher/tests/test_WSGIPublisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ def next(self):
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
Expand All @@ -182,6 +183,7 @@ def __len__(self):
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()
Expand Down

0 comments on commit dcd81ee

Please sign in to comment.