Liz Pelletier
[[
Hi all - I am selecting certain
records from a table. Within the <dtml-in> loop,
I need to execute a cgi script residing on a second
server (which is not hosting zope) for each row of returned data. How?? I can’t
use RESPONSE.redirect, that I know of, because it does not return control to the
originating zope page it was called from after executing. I’ve installed ZCGI,
but that doesn’t seem to facilitate cgi scripts on a
different machine. I’ve tried a simple python script which imports urllib and then try’s a urlopen, but that didn’t work either. Has anybody had to
solve a similar problem or know where I’m going wrong ?
]]
I like external Python
methods for that kind of thing. There are a few things to beware of, though
(not specific to external methods). First, the call for each row will have
to complete before the next one starts, which will probably be very time
consuming. To avoid this, you would use multiple threads in an external
method. But even then, if one of the sites does not respond for any
reason, its thread will not return (or it may have to wait for a long timeout,
like minutes in some cases). You will not be able to complete until all
threads return, so you can still get long delays. To avoid this, it would
be possible to write code to test a site first to see if it responds, (you may
have to get a special socket library that can be interrupted if it is hanging -
I know that at least one such library exists for Python) but of course it would
be more complicated.
To
sum up, you can make this work with external methods but you should see if you
can come up with some way to avoid the need for going to a site for each
row. Can you cache the data, for example?
Cheers,
Tom
P