[Zope] iterating over key/value pairs

Dirk Datzert Dirk.Datzert@rasselstein-hoesch.de
Tue, 01 Jan 2002 22:00:40 +0100


use mapping attribute of dtml-in:


>
> <SELECT NAME="race">
>   <dtml-in expr="get_descriptions()" mapping>
>     <OPTION VALUE="<dtml-var code>"><dtml-var description></OPTION>
>   </dtml-in>
> </SELECT>
>

You have to return a object-list from get_descriptions like the following:

result = []

do a loop for objects:

    object = { 'code' : thema, 'description' : description }
    result.append(object)

return result


>
>
> Thanks,
> John Hunter