|
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"
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)
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
</Files>
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!
|