[mod_python] Query about client server interaction

Gregory Bond gnb at itga.com.au
Wed Jan 22 14:38:14 EST 2003

> 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?

This seems to work:

File ltest.py:

	import time
	from mod_python import apache

	def longtime(req):
	    req.content_type = "text/html"
	    <head><title>Example Delay Code</title></head>
	    Please wait.  This could take a long time!!!!
	    for i in range(20):
	        req.write("<li> Still waiting.... %d\n" % i)
	    return '</ul>\nAll Done!\n</body></html>'

with a URL like .../ltest.py/longtime and a config like
	<Files ltest.py>
	        PythonHandler   mod_python.publisher

Again, this won't work if your long-running job (here represented by
time.sleep() calls) is not able to stop and do a 'req.write()' every so often!

More information about the Mod_python mailing list