[Zope] Accessing individual items within a list

McDonnell, Larry lmcdonnell@protonenergy.com
Fri, 30 May 2003 13:36:08 -0400


Hi,

I still see a KeyError.

<dtml-var pbtemp[0]>
<dtml-var pbtemp[1]>
<dtml-var pbtemp[2]>

<dtml-in expr="_.range(2)">

<dtml-var pbtemp[_['sequence-index']]>

</dtml-in>

-----Original Message-----
From: Andreas Jung [mailto:andreas@andreas-jung.com]
Sent: Friday, May 30, 2003 1:25 PM
To: McDonnell, Larry; Passin, Tom; 'Zope@Zope. Org' (E-mail)
Subject: RE: [Zope] Accessing individual items within a list




--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