[Zope] multipart pushing
Michel Pelletier
michel@digicool.com
Sun, 25 Feb 2001 11:14:19 -0800 (PST)
On Sun, 25 Feb 2001, Ivan Cornell wrote:
> Philippe J wrote:
>
> > > I'd like to implement a chat function using the multipart content type and
> > I
> > > wonder if that is possible with Zope. My idea is to write a python script
> > that
> > > pushes the content of a database until e.g. the stop button is pressed in
> > the
> > > Browser. But how would the script know that it's supposed to stop? And
> > would
> > > such a longtime connection completely occupy one Zope thread so that I'd
> > have
> > > to increase the number of threads?
> >
> > Not sure about the threads, but a quite comonly used trick is to generate
> > the html page as the chat evolves, without writting the ending </html> tag.
> > The browser will think the connexion is slow, and will continue to display
> > the page. You should not, however, use complex layout (tables), as the
> > browser sometimes need a complete page to display those.
> >
>
> I fairly sure this won't work, as I believe Zope renders a complete page before
> sending it the client browser. This is unlike something like PHP which sends
> the page as it interprets it. This confused me when I first switched as I was
> trained to always send headers before any output, however in zope you can
> manipulate the REQUEST object right up to the end of your page.
You can send streaming output with RESPONSE.write() which is documented in
the online help system.
-Michel