[Zope] Dealing with Dictionaries

James W. Howe jwh@allencreek.com
Thu, 02 Mar 2000 09:13:54 -0500


At 09:27 PM 3/1/00 -0600, Evan Simpson wrote:
>----- Original Message -----
>From: James W. Howe <jwh@allencreek.com>
> > > > <dtml-return "_['dictionaryVariableName'].keys()">
>
> > I get an "AttributeError" on "keys".
>
>Hmm.  Somehow you aren't getting a dictionary, then.  It's hard to tell from
>just what you've posted where it's going astray.  Are you dtml-return-ing a
>literal dict as in your initial posting?  How is dictionaryVariableName set?

Here's what I've got.  First, I have a DTMLMethod named creditCardsAccepted 
which is defined as follows:

<dtml-return "
{
'Visa':'V',
'Mastercard':'MC',
'American Express':'AE',
'Diners Club':'DC',
'Discover':'DS',
'Carte Blanche:'CB',
'Japanese Credit Bureau':'JCB',
'Transmedia':'T'
}">

I then have a method called creditCardSelections which is defined as follows:

<dtml-return "creditCardsAccepted.keys()">

(I also tried <dtml-return "_['creditCardsAccepted'].keys()">)

When I try to "view" my creditCardSelections, I get the attribute error on 
'keys'.

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