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

Loren Stafford lstafford@morphics.com
Fri, 17 Aug 2001 09:23:11 -0700


Thanks Tom, Adam, Andy,

That's just what I needed. Now that I know the answer, I can find where it
is documented. Just for the record, 'update' is a method of mapping types
and is documented at:

   http://www.python.org/doc/current/lib/typesmapping.html

-- Loren


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