On Sat, 2006-11-11 at 16:38 -0800, Bob Ippolito wrote:
> On 11/11/06, iain duncan <[EMAIL PROTECTED]> wrote:
> >
> > When we send stuff to kid, it gets them as a dictionary. What if we want
> > to send a dictionary in the dictionary? I am able to get kid to
> > dereferrence the first level ok,
> >
> > ie, the items in the cart are themselves dictionaries, with the name as
> > the key.
> >
> > for item in cart.item
> > ${item} <-- key name of my sub dictionary,
> > ${item['quant']} <-- error
> > ${item.quant} <-- error
> >
> > Is there a way to have nested dictionaries passed to kid or will I need
> > to redesign the container?
>
> That doesn't have anything to do with kid, but how dictionaries work.
> Iterating over a dictionary gives you its keys. If you want the (key,
> value) pairs then use "for key, value in cart.item.iteritems()".
Ah, because in kid, I'm iterating in Python ( which I should have
known!) I will confess my head has been spinning when switching between
js and python and js turned pythony. :/
Iain
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---