On 11/8/05, Roman Suzi <[EMAIL PROTECTED]> wrote:
 > I don't know if writing to response one chunk at a time is proper
> solution? Will Zope store response body or sent it right away? I am not
> sure that it is the later...

The classic way to do streaming data in Zope is like so:

RESPONSE.setHeader('Content-length', N)
for chunk in some_iterable_yielding_data:

... where N is the size in bytes of the data you are going to write.

However, you can also publish any method that returns an
implementation of IStreamIterator as shown in

The advantage is that this has less overhead, as once your method has
returned, the Zope app and ZODB are no longer involved, and your
iterator and ZPublisher do all the work.
This can become quite significant when you are streaming large data,
more than a few hundred kB. However, your iterator *must* be able to
do its work without a ZODB connection.

You haven't said where the data you want to stream is going to come from,
so I can't guess whether the IStreamIterator technique will work for you...

Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to