I just discovered that the REQUEST object doesn't support dictionaries. Right? So, given that I'm writing DTML because I'm in the middle of a calendar tag, how can I create a dictionary for the duration of a request and add items to it? -- Loren
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.
-----Original Message----- From: Loren Stafford [mailto:lstafford@morphics.com] Sent: Thursday, August 16, 2001 18:20 To: zope@zope.org Subject: How to put a dictionary in REQUEST?
I just discovered that the REQUEST object doesn't support dictionaries. Right?
So, given that I'm writing DTML because I'm in the middle of a calendar tag, how can I create a dictionary for the duration of a request and add items to it?
-- Loren
Try this: <dtml-call "REQUEST.set('colorAssignment',{})"> <dtml-call "colorAssignment.update({Subject:nextColor})"> On 16 Aug 2001 18:41:31 -0700, 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.
-----Original Message----- From: Loren Stafford [mailto:lstafford@morphics.com] Sent: Thursday, August 16, 2001 18:20 To: zope@zope.org Subject: How to put a dictionary in REQUEST?
I just discovered that the REQUEST object doesn't support dictionaries. Right?
So, given that I'm writing DTML because I'm in the middle of a calendar tag, how can I create a dictionary for the duration of a request and add items to it?
-- Loren
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- "There's never enough time to do | M. Adam Kendall all the nothing you want." | mak@kha0s.org -Bill Watterson (Calvin and Hobbes) | http://www.zopelabs.com
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
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
participants (3)
-
Loren Stafford -
M. Adam Kendall -
Tom Jenkins