[Zope] calling a python script from a dtml method
Andy McKay
andym@ActiveState.com
Tue, 13 Feb 2001 13:27:55 -0800
> From: D Blanding
>
> Hello-
> I'm new to Zope... (have read the Zope Book) and have used Python.
> For my first Zope project, I'm building a web application that stores and
> retrieves stuff from the Z-Gadfly RDB. I have successfully written a
python
> script which calls a zsql method which selects all the records of my
table.
You might want to not use ZGadfly, it have a feeling it doesnt store data
between reboots...
> (The table is not very big.) The python script then converts each record
to
> a list (adding a couple of fields and doing some arithmetic, etc.) then
> appends all these lists together into one big list. The python script
takes
> no arguments.
>
> Now I want to display the data in a table. So I plan to call the python
> script from a dtml method which will present the data. But I don't know
how
> to do this. Can anyone give me advice on how to do this?
<dtml-call pythonScript> or since you passing through data and wanting the
python script to print stuff
<dtml-var "pythonScript(list=the_list)">, you will need specify list as an
argument in your python method.
> Also, once I succeed in calling the python script, I'm not sure how I will
> parse a list of lists in dtml. I have seen examples using:
>
> <dtml-in>
> <dtml-sequence-item>
> </dtml-in>
>
> to parse lists but how do I read through a list of lists?
Preferably do it in python and as little as possible in dtml.
<dtml-in list_one>
<dtml-in "_['sequence-item']">
<dtml-var sequence-item>
</dtml-in>
</dtml-in>
Or something like that.
Thanks.
--
Andy McKay.