[Zope] trees

Oleg Machulski oleg_machulski@geocities.com
Mon, 24 May 1999 11:17:47 +0300


"Dmitry B. Khlonin" wrote:
> 
> How I make #tree if objects for #tree stored in database?
> for example - has two tables: TFolders and TObjects
> Each TObject found in one TFolder. How I make
> this #tree without making objects in Zope database?
> Obviously using only DTML.
Heh :-)

I already asked this question here, but there was no answer :-(

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-->


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