On Mon, 13 Oct 2003 18:35:44 +0100,
Simon Faulkner <ne**@titanic.co.uk> wrote:
Is there any way of flushing the first half of the page out before the
calculation starts?
You're better off using a redirect. On the inital request, run the
calculation in a subprocess or a subthread and return a brief page that says
"Please wait...". This page should contain a <META HTTP-EQUIV="Refresh">
element that will reload the page in some suitable time span. On reloading,
the application should check if the computation is done and either return
the results or another "Please wait" page.
Quixote pseudocode:
def calc [html] (request):
if not request.session.computation_in_progress():
# Fork off subprocess
elif request.session.computation_completed():
"Results:"
...
else:
# Computation is in process
"<html><head>"
'<meta http-equiv="refresh" content="10; %s">' % request.get_url()
'</head><body> ... </body></html>'
You'd have to write the computation_completed() and computation_in_progress()
methods.
--amk