[Zope] 2d list manipulation

Tim Russell snark@ou.edu
Sat, 9 Sep 2000 13:59:28 -0500


Hey, I'm having trouble accessing variables in a 2-dimensional list. Here's
the creation code:

   <dtml-call "REQUEST.set('col', [])">
   <dtml-in "_.range(0, 24)">
      <dtml-call "col.append([])">
      <dtml-let hour="_['sequence-item']">
      <dtml-in "_.range(0, hour_divisions)">
         <dtml-call "col[hour].append(0)">
      </dtml-in>
      </dtml-let>
   </dtml-in>

This creates a list variable, col, which contains 24 lists, each of which
have <hour_divisions> elements of value 0. I can easily access the value of
an element using:

   <dtml-var "col[index1][index2]">

However, the difficulty comes when trying to change the value of one of
these elements. I've tried a handful of techniques, mostly offshoots of
this:

   <dtml-call "REQUEST.set('col[index1][index2]', 5)">

to no avail. Does anyone have a solution to this? Thanks much...

--Tim