[Zope] How to call a python script within a Z-SQL method?

Terry Hancock hancock at anansispaceworks.com
Wed Nov 26 13:56:19 EST 2003


It was very unclear to me what you actually are trying to 
do here.  The subject line is easy -- you can call python
scripts exactly as you would from any other DTML:

<dtml-var expr="compute_entry_date(ham, spam)">

The result will be *rendered into the query* and then sent
to the SQL engine to return an SQL results object.

But your description clouds this.  It sounds like you 
actually want to do the query and then call a python
script to act on the *results of the query* not the *query*.

If that's the case, you need to wrap the SQL in a python
script call -- i.e. you don't want to call python from SQL,
you want to call an SQL query from python.  That's not
too hard, though -- the results object behaves very much
like a python sequence.

If you want to see what you're working with, just return the
object or a str() conversion of it so you can see the 
output.

I think you might have to rephrase your question in those
terms if it still isn't clear what you need to do.

Cheers,
Terry

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com



More information about the Zope mailing list