[Zope] Iterating over a Python list with <dtml-in>

Sven Jacobs jacobs at tedsoft.de
Fri Feb 6 03:37:17 EST 2004


Dear newsgroup,

I want to iterate over a list returned by a Python script using the 
<dtml-in> tag of Zope. The script looks like this:

# Script BEGIN
missing = []

for curprop in context.sqlGetObjectProperties(objid=curobjid):

   found = 0

   for prop in context.sqlGetObjectTypeProperties(objtypid=curobjtypid):
     if (curprop.propid == prop.propid):
       found = 1

   if (found == 0):
     missing.append(prop.propid)

return missing
# Script EOF

The test DTML document looks like this

<dtml-in 
expr="pyGetMissingObjectProperties(curobjid=objid,curobjtypid=objtypid)">
   <dtml-var sequence-index><br>
</dtml-in>

and works fine, I see several sequence indexes. But how do I actually 
access the values from the list? <dtml-var missing> within the <dtml-in> 
block does not work :(

Thanks for any help!
Sven Jacobs



More information about the Zope mailing list