Tim Parker (UK)
tim.parker at intec-telecom-systems.com
Tue Jan 21 09:08:16 EST 2003
Thanks Gregory, I am just wondering if it is possible to do this with the publisher handler - as that is what I am using at present as I have several python modules and functions that I need to use? Thanks again for all your help on this Tim. -----Original Message----- From: Gregory Bond [mailto:gnb at itga.com.au] Sent: 21 January 2003 00:28 To: Tim Parker (UK) Cc: 'mod_python at modpython.org' Subject: Re: [mod_python] Query about client server interaction > 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.). This e-mail and any attachments are confidential and may also be privileged and/or copyright material of Intec Telecom Systems PLC (or its affiliated companies). If you are not an intended or authorised recipient of this e-mail or have received it in error, please delete it immediately and notify the sender by e-mail. In such a case, reading, reproducing, printing or further dissemination of this e-mail is strictly prohibited and may be unlawful. Intec Telecom Systems PLC. does not represent or warrant that an attachment hereto is free from computer viruses or other defects. The opinions expressed in this e-mail and any attachments may be those of the author and are not necessarily those of Intec Telecom Systems PLC. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.modpython.org/pipermail/mod_python/attachments/20030121/8dc051ba/attachment-0003.htm
|