Alejandro Fernandez writes:
I'd like to do a page to show to users while something loads. It would show users what queries have been executed from a database as they are executed. If the whole thing works, they then go to the page where they are shown the results of those queries.
I'm doing this with dtml-calls to queries, which if working will say "query executed".
But the page I've made to do this doesn't show this info - it only loads once everything is done. HTTP is a very simple protocol. For each request, you get a single reponse, i.e. one page.
You can force Zope to send the response and then continue work. You would use the "RESPONSE.write" method for this. There is a caveat with this: You must either know the total size of the complete response or you must use "Transfer-Encoding: chunked" and use "chunked" encoding. The first alternative means that the continued work may not produce any output. The second alternative is only available for HTTP/1.1 clients. You may try a "Connection: close" header and not send the "Content-Length". I am not sure, whether this will work, especially because "RESPONSE.write" will add a "Content-Length" when it is not specified. An alternative is to send a complete response (with "RESPONSE.write"), that uses the non-standard "refresh" meta tag (see a good HTML documentation) to automatically start a new request. The continued work must put its results somewhere, maybe in the session object. The new request will look there and show the results or refreshes itself again. Dieter