[Zope] Streaming Response

Danny W. Adair danny@adair.net
Mon, 07 Apr 2003 09:52:25 +1200


Hi,

I would like to show status messages while calling a couple of functions 
from within a Python Script: While the script is running, I want to 
successively output messages like

------------------------
Doing this...ok
Doing that...ok
Done
------------------------
and then either redirect or display a button to move on.

1. I do _not_ want to use JavaScript
2. I do _not_ want to use the meta tag "refresh"

I would like to use Response.write() to push my status messages on the fly.
Since I don't know which function calls will succeed and which will fail, I 
do not know "Content-Length" in advance. Therefore, I would like to use a 
streaming/chunked response as specified in HTTP 1.1.

How do I do this in Zope?

I tried to do "response.setHeader('Content-Type', 
'multipart/x-mixed-replace')" but couldn't get it working. (Also, it looks 
as if this will only work in Netscape but not IE. True?)

I also tried to leave the header alone and just "Response.write()" the 
multipart content-type and its boundary and the content-type's of the 
parts, but ZPublisher just returned the plain text...

I guess the answer lies somewhere in "Transfer-Encoding: chunked" but I 
can't figure out how to actually do it. :-)

Maybe one of you guys working on HTTPResponse (Fred, Chris, Brian, Toby, 
Andreas) knows how to accomplish this?

Thank you very much for your help,
Danny

P.S.: Please include my address in your reply ("Reply All") since I am 
currently not subscribed to this list. Thank you.