[Zope] 2d list manipulation

Stephan Richter srichter@cbu.edu
Sat, 09 Sep 2000 15:43:55 -0500


At 03:40 PM 9/9/00 -0500, Tim Russell wrote:
>That's the thing -- It doesn't give any errors, it just doesn't have any
>effect on the value in the array. Weird, no?
>
>--Tim
> > >Nope, still nothing...
> > >
> > > > >    <dtml-call "REQUEST.set('col[index1][index2]', 5)">
> > > >
> > > > Just try it without the single quotes:
> > > >
> > > > <dtml-call "REQUEST.set(col[index1][index2], 5)">
> >
> > Can you send me the traceback?

Thinking about it again makes me realize that it will not work, since set 
just sets a variable, but does not take care of assignments. It is a little 
bit hard to explain, maybe someone else can do a better job.
Here is what you would have to do:

<dtml-var standard_html_header>
   <dtml-call "REQUEST.set('a', [[0, 0], [0, 0]])">
   <dtml-call "REQUEST.set('a1', a[0])">
   <dtml-call "a1.insert(0, 1)">
   <dtml-call "a.insert(0, a1)">
   <dtml-var "a[0][0]">
<dtml-var standard_html_footer>

This code is tested and works. But you will see that this is far too 
complicated, thats why I would suggest you use a Python Method or an 
Eternal Method to solve the issue.

Regards,
Stephan
--
Stephan Richter
CBU - Physics and Chemistry Student
Web2k - Web Design/Development & Technical Project Management