[Zope] Dictionaries in DTML

John R. Daily jdaily@progeny.com
Tue, 06 Mar 2001 08:39:37 -0500


I'm perplexed by dictionary handling in DTML.

>From a Python Script, I'm returning a dictionary.

The Zope Book and other DTML documentation refers to a mapping
attribute in <dtml-in>, but provides no examples, and I'm afraid I
can't get anything to work, with or without that attribute.

I've even stripped out access to the values, and still nothing works.

I've created a simple Python script ("return_dict"):
---
return { "foo" : "bar", "input" : "output" }
---

And a simple DTML script:
---
<dtml-in expr="return_dict()" mapping>
foo
</dtml-in>
---

With or without the mapping attribute, that gives me a KeyError: 0,
with the problem occuring in DT_In.py, in renderwob().

What am I doing wrong, and moreover, once I'm doing it right, how do I
access the values?

--                                                                   --
John R. Daily                                        jdaily@progeny.com
Systems Programmer                                Progeny Linux Systems
		  Master of the ephemeral epiphany