[Zope] RE: How to put a dictionary in REQUEST?

Tom Jenkins tjenkins@devis.com
Thu, 16 Aug 2001 22:28:34 -0400


Loren Stafford wrote:
> OK. I didn't describe the problem very well. The REQUEST object does have
> dictionaries in it, and you can add a dictionary...
> 
>   <dtml-call "REQUEST.set('colorAssignment',{})">
> 
> ... but how can you add keys to a dictionary in REQUEST using DTML?
> 
> Clearly you can't
>   <dtml-call "REQUEST.set('colorAssignment[Subject]',nextColor)">
> 
> The perlish ...
>   <dtml-call "colorAssignment.append[Subject,nextColor]">
> ...doesn't work either.
> 

Very close. This one was a tough one.  Here's what we came up with...

<dtml-call "colorAssignment.update({Subject:nextColor})">

I thought <dtml-call "colorAssignment[Subject] = nextColor"> should work 
as that's what you do in python, but zope choked on it.

(now lets see if I beat Adam in posting it)

-- 
Tom Jenkins
devIS - Development Infostructure
http://www.devis.com