[Zope] Accessing individual items within a list

Andreas Jung Andreas Jung <andreas@andreas-jung.com>
Fri, 30 May 2003 19:25:00 +0200


--On Freitag, 30. Mai 2003 13:18 Uhr -0400 "McDonnell, Larry" 
<lmcdonnell@protonenergy.com> wrote:

> Hi,
>
> Let try this again.
>
> I have a form with the following input statements:
>
> <input type="text" name="pbtemp[1]" size="6"> = 'aa'
> <input type="text" name="pbtemp[2]" size="6"> = 'bb'
> <input type="text" name="pbtemp[3]" size="6"> = 'cc'

Using names with slice notation is really odd. What is the purpose???
>
> After the submit I can display the variables using this method:
>
> <dtml-var pbtemp[1]>
> <dtml-var pbtemp[2]>
> <dtml-var pbtemp[3]>
>
> I see
>
> aa bb cc
>
> I am trying to find a way to use this method but my syntax is wrong:
>
> <dtml-in expr="_.range(3)">
>
> <dtml-var pbtemp[_['sequence-index']]>
>
> </dtml-in>
>
> I see the following error:
>
> Error Type: KeyError
> Error Value: pbtemp[_['sequence-index']]
>

range(2) iterates from 0..2 and not from 1..3.

-aj