[Zope] Looping in DTML

Dieter Maurer dieter@handshake.de
Tue, 25 Feb 2003 23:29:03 +0100


Flavio wrote at 2003-2-24 16:04 -0500:
 > ....
 > <dtml-in (ordnumber,description)>
 >   <dtm-var sequence-item>
 > </dtml-in>
 > 
 > output
 > 
 > 01  Freight
 > 02  Delivery

You can use "map(None,l1,l2)" to "transpose" the two lists:

  If "l1" is "x1,x2,..." and "l2" is "y1,y2,...",
  then "map(None,l1,l2)" is "(x1,y1), (x2,y2), ...".

You can then iterate over the result: "sequence-key" will be the
element from the first and "sequence-item" the from the second list.


Dieter