[Zope] "Treeing" a dictionary

Gary Perez garyp@asti-usa.com
Thu, 25 Jan 2001 12:48:04 -0500


Hi, all.

I've been playing with the XML Document product and the <dtml-tree>
tags. Works quite nicely. Is there any way to duplicate this "treeing"
in Zope for a dictionary (with embedded dictionaries) coming in from an
external method?

For example, the external method is returning to Zope something like this:
{'Category 1': {'Section 1': {'Key 1': 'Value 1.1.1', 'Key 2': 'Value
1.1.2'}}, {'Section 2': {'Key 1': 'Value 1.2.1', 'Key 2': 'Value 1.2.2'}}}

Or, a little easier on the eyes:
{'Category 1':
	{'Section 1':
		{'Key 1': 'Value 1.1.1', 'Key 2': 'Value 1.1.2'}
	},
	{'Section 2':
		{'Key 1': 'Value 1.2.1', 'Key 2': 'Value 1.2.2'}
	}
}

Is there some way in Zope to tree this dictionary up like so (expanded)?:

[-] Category 1
	[-] Section 1
		Key 1
		Key 2
	[-] Section 2
		Key 1
		Key 2

Alternately, what type of objects is the <dtml-tree> tag looking for
when constructing the tree? Would it be easier to "programatically"
generate those types of objects from the dictionary using either DTML or
an external python module?

Any help or insight is greatly appreciated.
-Gary