-----Original Message----- From: Oleg Machulski [mailto:oleg_machulski@geocities.com] Sent: Monday, May 24, 1999 4:18 AM To: Dmitry B. Khlonin; zope@zope.org Subject: Re: [Zope] trees
I tried the following DTML code:
<!--#call "REQUEST.set('ttt', {'a1': {'b': 'bbb1', 'c': 'ccc1', 'a': 'aaa1'}, 'b': 'bbb', 'c': 'ccc', 'a2': {'b': 'bbb2', 'c': 'ccc2', 'a': 'aaa2'}, 'a': 'aaa'} )"-->
<!--#tree name="ttt" branches="keys" leaves="keys"--> <!--#var id-->, '<!--#var expr="_"-->' <!--#/tree-->
The objects that your tree tag iterates over must have an 'id' attribute if you want to say <!--#var id--> Otherwise the DocumentTemplate will look 'up' in the namespace and find the folders 'id', like it does. Unlike, 'in' where there is a 'sequence-item' variable, the 'tree' tag has no coresponding 'tree-item' variable. It is just assumed you are iterating over objects with attributes that you are looking for. Adding a 'tree-item' looks like a good idea, then you could say <!--#var "tree-item[0]"--> to get what looks like your looking for. Patches, as allways, are welcome, otherwise this will go on the back burner. -Michel PS: Oleg, can you not send HTML formated mail to the list? It makes it a bit difficute to answer your mail from mailers that don't support HTML.
and it generates the tree with 5 branches (accoarding to 5 keys in array 'ttt'), but <!--#var id--> is substituted as id of folder, containing this dtml method. I just do not know why this construction works :-), but seems, we have to guess 2 things: 1) how to retrieve leaves for each branch 2) which symbol to use in the body of the #tree tag to display contents.
after we guess guess it, it is possible to write 2 external python methods, which will retrieve corresponding sets from the database.
btw, I tried to find an example of such a custom tree in the Zope examples, or elsewhere in the internet, but search failed :-(
-- Best regards
Oleg Machulski ---------------------------------------------------- http://www.geocities.com/SiliconValley/Network/7671/ mailto:oleg_machulski@geocities.com
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(For developer-specific issues, use the companion list, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
participants (1)
-
Michel Pelletier