[Zope] Dealing with Dictionaries

James W. Howe jwh@allencreek.com
Wed, 01 Mar 2000 13:03:20 -0500


I have a DTML method from which I want to answer a dictionary.  It looks 
something like this:

<dtml-return "{'foo':'bar', 'biff':'boom'}">

I want to be able to use this information in two different ways.  First, I 
want to be able to get a list of keys from the dictionary.  Second, I want 
to be able to get a list of values.  I could easily do this in Python, but 
I'm sure there must be a simple way to do this in DTML.  I tried something 
like:

<dtml-return "_['dictionaryVariableName'].keys()">

but that didn't work.  I did notice that if I just used 
"_['dictionaryVariableName']" I actually got the keys.

Basically I'm trying to create a system by which a user can enter a full 
string and an abbreviation for the string.  I want to be able to produce a 
list of the full strings, and I want to be able to produce a list of the 
abbreviations.

Any help would be appreciated.

Thanks.

James W. Howe				mailto:jwh@allencreek.com
Allen Creek Software, Inc.		pgpkey: http://ic.net/~jwh/pgpkey.html		
Ann Arbor, MI  48103