filestream_range_iterator needed a __len()__ method
1letter opened this issue · 1 comments
1letter commented
1letter commented
should the implemented interface changed from
@implementer(IStreamIterator)
class filestream_range_iterator(Iterable):
to
@implementer(IUnboundStreamIterator)
class filestream_range_iterator(Iterable):
because the WSGIResponse Object in Zope.ZPublisher.HTTPResponse check for IUnboundStreamIterator not for IStreamIterator
def setBody(self, body, title='', is_error=False, lock=None):
# allow locking of the body in the same way as the status
if self._locked_body:
return
if isinstance(body, IOBase):
body.seek(0, 2)
length = body.tell()
body.seek(0)
self.setHeader('Content-Length', '%d' % length)
self.body = body
elif IStreamIterator.providedBy(body):
self.body = body
super(WSGIResponse, self).setBody(b'', title, is_error)
elif IUnboundStreamIterator.providedBy(body):
self.body = body
self._streaming = 1
super(WSGIResponse, self).setBody(b'', title, is_error)
else:
super(WSGIResponse, self).setBody(body, title, is_error)
But i'm not so deep in this package, to answer this question.