[Zope-DB] How to send a 'still working' message ?
Thu, 18 Apr 2002 23:45:28 +0200
Emmanuel Courcelle writes:
> I have an external python procedure, with some code like this:
> for p in some_list:
> There are about 10 iterations or more, and each iteration takes about
> 5 to 10 seconds. So, it would be nice if I could send an html page
> with some message like:
> 'Now working on iteration %i...' % p
> and of course another message would be displayed at each iteration.
> But how can I do this ???
> I need some sort of unbuffered output from my procedure, but I do not
> know how to do this.
If you are sure, there will be no exceptions (or you catch and handle
them yourself), you can use "RESPONSE.write".
It will not work with all browsers though. Some browsers require
to a correct "Content-Length" header (to detect the end of the
request). It might help to tell the browser that the connection
will be closed at the request end. (I did not yet try to find
out how to do this).