[Zope-dev] Streaming?

Lalo Martins lalo@hackandroll.org
Mon, 30 Oct 2000 02:19:59 -0200


Never mind, I found it. Just for the record, if anyone else
needs this:

The class HTTPResponse (in ZPublisher/HTTPResponse.py) has a
"write" method. When you're publishing to the web, the RESPONSE
object is an instance of this class.

    def write(self,data):
        """\
        Return data as a stream

        HTML data may be returned using a stream-oriented interface.
        This allows the browser to display partial results while
        computation of a response to proceed.

        The published object should first set any output headers or
        cookies on the response object.

        Note that published objects must not generate any errors
        after beginning stream-oriented output. 

        """

I don't know if this is documented somewhere, but it does what
I wanted.


On Sun, Oct 29, 2000 at 11:05:25PM -0200, Lalo Martins wrote:
> Is it possible to "stream" (send data to the client via HTTP
> incrementally) from Python code, or does ZPublisher only send
> the data as a single wad when the method returns?
> 
> Assuming it is possible, obviously it requires using some other
> API rather than just 'return'ing a string... where can I find
> documentation and/or examples on that? If there is no existing
> documentation or examples, source code would do.
> 
> (Context: when the tests are running on ZUnit, I'd like to give
> some visual feedback, if possible by sending the dots returning
> by PyUnit in real-time)

[]s,
                                               |alo
                                               +----
--
          Hack and Roll  ( http://www.hackandroll.org )
            News for, uh, whatever it is that we are.


http://zope.gf.com.br/lalo           mailto:lalo@hackandroll.org
         pgp key: http://zope.gf.com.br/lalo/pessoal/pgp

Brazil of Darkness (RPG)    ---     http://zope.gf.com.br/BroDar