Hi Jonathan, Jonathan Hobbs wrote:
Thanks to those who responded with some ideas regarding my RESPONSE.write problem - but it's still not working!
Based on the responses I now have a dtml method containing (note: I have tried it with and without the Transfer-Encoding header):
<dtml-call "RESPONSE.setHeader('Transfer-Encoding', 'chunked')"> <dtml-call "RESPONSE.setHeader('Content-Type', 'text/plain')"> <dtml-call "RESPONSE.write('Starting\n')"> <dtml-call "RESPONSE.flush()">
<dtml-call "wait(5)">
<dtml-call "RESPONSE.write('Done\n')"> <dtml-call "RESPONSE.flush()">
The 'wait' routine is still a simple external method:
import time def wait(self, secs): time.sleep(secs) return
What I expected to see was the word 'Started' displayed in my browser, followed by a 5 second delay, and then see the word 'Done' displayed.
What I get is a 5 second delay and then both 'Started' and 'Done" appear at the same time.
1.) I dont think using DTML is a good idea for this, and not because I hate DTML but because almost every tag in DTML actually produces output - and this stands diametrical against your desire to control output via response.write() response.write() just switches output mode from one single response at the end of publishing to small chunks during publishing process. 2.) With recent Zope (2.6+) you dont send Transfer encoding and stuff because ZPublisher does this on its own when you use response.write() response.flush() just does nothing. - if there is any caching and buffering active it will remain. If it does not work out just make sure you are using a current Zope version, since things are probably broken in older. Regards Tino Wildenhain