[Zope] Time-consuming External method blocks Zope execution

Olivier Deckmyn odeckmyn.list@teaser.fr
Wed, 13 Jun 2001 10:00:01 +0200


If anybody has done this in Zope, I would be REALLY interessted in getting a
close look at the code !

May be through an HowTo on zope.org ?

Thanx !

----- Original Message -----
From: "Jerome Alet" <alet@unice.fr>
To: "Etienne Labuschagne" <etiennel@geospace.co.za>
Cc: "Zope user list (E-mail)" <zope@zope.org>
Sent: Wednesday, June 13, 2001 9:48 AM
Subject: Re: [Zope] Time-consuming External method blocks Zope execution


> On Wed, 13 Jun 2001, Etienne  Labuschagne wrote:
>
> > I know that I can make my long process run in a thread and return
> > immediately, but how do I notify the client browser when the thread have
> > finally finished.  Is the only way to write a self-reloading page as
> > response for the client so that his browser checks every now and again
if
> > the process is finished
>
> There's a solution for that, I've used it in a CGI script to solve a
> browser (or Apache) timeout problem when launching long SQL queries, but
> have not implemented it in Zope, so I don't know how this would apply to
> Zope.
>
> you have to return a document which content-type is:
>
> multipart/x-mixed-replace;boundary=XXX
>
> where XXX is some random string.
>
> the first line of you document must contain:
>
> --XXX (same XXX as before)
>
> then you launch a thread which periodically send a normal CGI document
> (with headers, and content-type=text/html for example) displaying for
> example the elapsed time since you've begun to convert files, but this
> document must end with "\n--%s" % XXX (still same XXX as above)
>
> then you start to convert files.
>
> During the conversion your thread will periodically send a new page to
> your browser, so you can display in it as many info as you want: elapsed
> time, number of converted files, etc...
>
> when it's finished you end the thread.
>
> then you finish the enclosing CGI document which content type is
> multipart/x-mixed-replace, terminating it with:
>
> "\n--%s--" % XXX (still same XXX)
>
> then it's done.
>
> I don't know if this would work at all in Zope, but I suppose you can try
> this way.
>
> Anyway I can send to you my python CGI script if you want.
>
> bye,
>
> Jerome Alet
>
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )