[Zope] iteration through list with dtml-tags

John Hunter jdhunter at ace.bsd.uchicago.edu
Wed Aug 7 09:16:44 EDT 2002

>>>>> "Axel" == Axel Bock <news-and-lists at the-me.de> writes:

    Axel> no, i think you did well understand the problem. But I do
    Axel> not use ZSQL methods, and I am getting a list of tuples, as
    Axel> I said. And these are not so easily dereferenced (cause
    Axel> there are no names ... :-)

You can also work directly with tuples, and reference the elements in
an arbitrary order, as the example below illustrates.  The prefix on
the dtml-in tag is not necessary, but I think it reads better:

  <dtml-in "[ ('John', 'Hunter', 1234, 'jdhunter at paradise.lost'),
              ('John', 'Doe', 1235, 'billyboy at yahoo.edu'),
              ('Jane', 'Smith', 1238, 'jane at myserver.com')]" 
      <td><dtml-var "people_item[0]"> <dtml-var "people_item[1]"></td>
      <td><dtml-var "people_item[3]"></td> 
      <td><dtml-var "people_item[2]"></td>

John Hunter

More information about the Python-list mailing list