[Zope] - Access to sequence-item?

Andy Smith andy@verticality.com
Thu, 10 Dec 1998 13:47:47 -0500


There may be a nicer way of doing it, but you can access the outerlist by
using _.namespace to insert the orignal value of sequence-item into the DTML
namespace as a new variable. In situations where you've got  '-' in your
name, you can always use _['sequence-item']

<!--#var standard_html_header-->

<!--#in "[ [1,2,3], [4,5,6], [7,8,9], ['foo','bar']]"-->
   <!--#with "_.namespace(outeritem=_['sequence-item'])"-->
   <!--#in sequence-item-->
      I am looping over : <!--#var outeritem--> and I've got to <!--#var
sequence-item--><BR>
   <!--#/in-->
   <!--#/with-->
<!--#/in-->
<!--#var standard_html_footer-->

Cheers,

Andy.


> -----Original Message-----
> From: scharf@news.rhein-neckar.de [mailto:scharf@news.rhein-neckar.de]On
> Behalf Of Michael Scharf
> Sent: Thursday, December 10, 1998 1:14 PM
> To: zope.org
> Subject: [Zope] - Access to sequence-item?
>
>
> I think it is a bad decision to use the '-' in special names.
> Here is my problem:
>
>    <!--#in outer_list-->
>      <!--#in inner_list-->
>         How to access the sequence-item?
>           this does not work:
>             <!--#var expr="DoSomethingWith(sequence-item)"-->
>         How to acces to the outer_list.sequence-item?
>           This does not work:
>             <!--#var expr="DoSomethingWith(outer_list.sequence-item)"-->
>           neither does this work:
>             <!--#with "_.namespace(inner_item=sequence-item)"/>
>                 <!--#var expr="DoSomethingWith(inner_item)"-->
>             <!--#/with-->
>         This indicates, what is going on:
>         <!--#with "_.namespace(sequence=42,item=1)"/-->
>             inserts 41!!!
>             <!--#var expr="sequence-item"-->
>         <!--#/with-->
>
>      <!--#/in-->
>    <!--#/in-->
>
>
> I think it would be nice, if the <!--#in --> would support
> an 'as' attribute:
>    <!--#in outer_list as="outer_item"-->
>      <!--#in inner_list as="inner_item"-->
>        <!--#var expr="DoSomethingWith(inner_item)"-->
>        <!--#var expr="DoSomethingWith(outer_item)"-->
>      <!--#/in-->
>    <!--#/in-->
>
> Or am I missing something???
>
> Michael
> --
>      ''''\     Michael Scharf
>     ` c-@@     TakeFive Software
>     `    >     http://www.TakeFive.com
>      \_ V      mailto:Michael_Scharf@TakeFive.co.at
>
>