[mod_python] Query about client server interaction

Tim Parker (UK) tim.parker at intec-telecom-systems.com
Wed Jan 22 09:54:10 EST 2003


Thanks for this - it seems to work except it takes a few seconds to display
the page - and when it does it draws it with several of the "Still waiting"
lines.  After this it then continues as I would expect it to but it seems to
wait a few seconds - well 5 times round the for loop before output the HTML
page to the Client.

Why is this, I would expect it to draw the web page almost immediately with
the Please wait This could take a long time!!!! Line and then draw in the
remaining lines as the script processes.  But it seems to want to cache the
first few lines before drawing them on the client.

Is this some server/client setting or something that needs to be specified
in the Headers so that there is no caching?

Thanks again
Tim.

-----Original Message-----
From: Gregory Bond [mailto:gnb at itga.com.au]
Sent: 22 January 2003 03:38
To: Tim Parker (UK)
Cc: 'mod_python at modpython.org'
Subject: Re: [mod_python] Query about client server interaction 

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


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/20030122/3ee38cd6/attachment-0003.htm


More information about the Mod_python mailing list