[Zope] DTML and Lists
Dieter Maurer
dieter@handshake.de
Thu, 22 Feb 2001 20:30:19 +0100 (CET)
Leonardo Mota writes:
> I'd pretty much a newbie at Zope and running into some problems. I
> have to make a <dtml-tree> with it's branches being fetched from a
> database, that's already done but I also need to carry a variable with
> the whole hierarchy to the last leaf of the tree.
Are you sure, you need this?
It is somewhat against the philosophy of the tree tag.
> ...
> Reading <dtml-tree>'s docs I've found a list that carries what I
> want, "tree-state", but I have no idea on how to access list's members
> on DTML. I've tried <dtml-var tree-state[0]> with no success.
"tree-state" is a sequence. Thus, in principle, you can access it
with the subscription syntax.
However, subscription will only work inside Python expressions.
As you use it, the "[0]" will be interpreted as part of the
single name "tree-state[0]". Try
<dtml-var expr="_['tree-state'][0]">
Be warned however, the structure is quite complex.
Personally, I was not yet able to understand it.
Dieter