[Zope] what's the equivalent of sequence-item and sequence-key
in tal:repeat
Joachim Schmitz
js@aixtraware.de
Mon, 10 Feb 2003 14:19:59 +0100
Your solution is not the equivalent of the dtml-in
here/get_all_languages returns a list of tuples:
[('aa', 'Afar'),
('ab', 'Abkhazian'),
('af', 'Afrikaans'),
.....
]
and in dtml-in sequence-item =3D Afar and sequence-key =3D "aa" for the =
first=20
item.
repeat/lang/index returns the index-number which is "0" for the first item.
I just found the right solution:
<td><select name=3D"languages:list" size=3D"5" multiple>
<span tal:define=3D"langs here/get_all_languages" tal:omit-tag=3D"">
<option tal:repeat=3D"lang langs"
tal:attributes=3D"value python: lang[0]; selected python: test(lang[0] in=20
here.getLanguages(), 1,0)"
tal:content=3D"python: lang[1]">German
</option>
I thought I had tried that before, but apparently not. I still don't like=20
the
python: lang[1] there should be something like:
repeat/lang/1
--On Montag, Februar 10, 2003 11:24:14 +0000 Felix Ulrich-Oltean=20
<felix@chaptereight.com> wrote:
> On Mon, 2003-02-10 at 10:41, Joachim Schmitz wrote:
>> what is the equivalent of this DTML snipplet in TAL ?
>>
>> <dtml-in get_all_languages>
>> <option value=3D"<dtml-var sequence-key>" size=3D40 <dtml-if
>> "_['sequence-key'] in
>> getLanguages()">selected</dtml-if>><dtml-var sequence-item></option>
>> </dtml-in>
>>
>
> Something like:
>
> <option size=3D"40"
> tal:repeat=3D"lang here/get_all_languages"
> tal:attributes=3D"value repeat/lang/index;
> selected python:repeat['lang'].index in \
> here.getLanguages() and 'yes' or nothing"
> tal:content=3D"lang">Language</option>
>
> More about this in the ZPT reference, Appendix (C) of the Zope Book:
> http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition
>
> The sequence stuff is covered under the "repeat" statement.
>
> F.
>
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
--=20
Mit freundlichen Gr=FC=DFen Joachim Schmitz
--------------------------------------------------------------------
AixtraWare Ingenieurb=FCro f=FCr Internetanwendungen
Telefon: +49-2464-8851, FAX: +49-2464-905163
--------------------------------------------------------------------