[Zope] Building a list programmatically under DTML

Evan Simpson evan@4-am.com
Tue, 07 Sep 1999 07:45:24 -0500


Martijn Pieters wrote:

> And straight again =):

[snip]

> But, you can't change a dictionary after creating it.

And one last teensy straightening <wink>.  You can use the update method of
dictionaries to change them, thus:

<dtml-call "REQUEST.set('letsgo', {1: 'a one'})">
<dtml-call "letsgo.update({2: 'and a two'})">
<dtml-call "letsgo.update({(1,2,3,4): 'and a one, two, three, four!'})">

You cannot, AFAIK, delete keys from DTML.  You can make a new copy of the
dictionary with only selected keys, but you're better off in External Methods
(soon PythonMethods!)