[Zope] dtml-in format

Ben Bush ben at center7.com
Thu Aug 7 23:15:03 EDT 2003


How do I address each item in the list? Can you give me an example if I 
were to return a list of integers and a dicitionary list.

Here is what I would be interested in knowing ->

Return [0,1,2,3]

Can I get a way with returning dictionaries inside of a list?
Return [{'field1':'value1'},{'field2':'value2'}]

Now for the part that is killing me. How do I address the values in the 
<dtml-in script> tags. If I use <dtml-in zsql_method> it works just fine 
for me by allowing me to address each field by name  (ie. <dtml-var 
description> if there was a description field in the database) How do I 
do that with the above examples.

Thanks for your help.



Dylan Reinhardt wrote:

>On Thu, 2003-08-07 at 15:24, Ben Bush wrote:
>  
>
>>I would like to use dtml-in to iterate through some results in a python 
>>script. I am not sure what format I need to put the results into in my 
>>python script to be able to reference them in the <dtml-in> tags. I am 
>>currently trying to return a dictionary but that does not seem to work.
>>    
>>
>
>
>You can't iterate over a dictionary... at least, not yet. :-)
>
>Instead, have the script return a *list* of items to iterate over.  That
>should do the trick.
>
>HTH,
>
>Dylan
>
>
>  
>





More information about the Zope mailing list