[Zope] zope and python script

Thomas B. Passin tpassin@mitretek.org
Wed, 27 Feb 2002 14:11:00 -0500


[<mbagepll@memphis.edu>]
>
> I (i am a newbie) have written a simple python script that queries a
> MS-SQL database and captues the result set into a list. I have called
> this sccipt in a dtml document and want to iterate through the list
> elements. When i do this-
> <dtml-in expr="Python_script()">
> <li>
> <dtml-var text>
> </li>
> </dtml-in>
>
> where, "text" is the list that is returned by the python scirpt. It
> says -
> Error Type: KeyError
> Error Value: text
>
> My question is, how do i iterate through the list and obtain the values
> from the list.

You're going to have to supply some more information.  Like, what is the
query, what is the script (or at least the signicant parts of it), is there
a column name in the data from the database called "text", what does the
script return, and so on.

This is probably a job done better and easier by  a ZSQL method than by a
python script, but you might still end up with the same problem, depending
on the answers to the questions.

Cheers,

Tom P