Gregory Bond
gnb at itga.com.au
Tue Jan 21 11:28:27 EST 2003
> This is both a bit of understanding mod_python and also how CGI scripts in > general work, basically I have a long running query which can take up to a > minute or so to process, I want to return a page to the User immediately > saying what it is doing, ideally I would like this page to get updated > during the processing of the other operation. Along with the other responses, I'd like to offer an alternative solution (that may or may not work, depending on how the job is structured). Anything you send to the client gets sent straight away, so you can use this fact to write on-going status messages. Something like this: import time from mod_python import apache def handler(req): req.content_type = "text/html" req.write('''<html> <head><title>Example Delay Code</title></head> <body> Please wait. This could take a long time!!!! <ul> ''') for i in range(20): time.sleep(2) req.write("<li> Still waiting.... %d\n" % i) req.write('</ul>\nAll Done!\n</body></html>') return apache.OK (I've added this as FAQ 3.7. Someone with more experience in redirects or refresh tags can add some alternatives.).
|