[Zope] Pass index in a TAL path expr

Andreas Jung lists at andreas-jung.com
Wed Apr 20 06:34:06 EDT 2005



--On Mittwoch, 20. April 2005 13:14 Uhr +0300 Vangelis Mihalopoulos 
<mihalop at vtrip.net> wrote:

>
> Hello,
>
> if  "data" is a tuple (or list), how can directly access it's contents
> using path expressions, like in:
>
> -- script "s":
> return context.t(data=("one", "two", "three"))
>
> -- template "t"
> <html><body>
>   <span tal:replace="options/data/0"></span>
> </body></html>
>
>
> The above example give out a TypeError for the index... "options/data/0"
> is not correct. What should i set the path to?

You have to use python: data[0]. Your notation is not supported.

-aj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20050420/1d152102/attachment.bin


More information about the Zope mailing list