Variable name of the ZOPE root? For use in TREE
Hi All, I have created a method using the DTML-TREE tag to create a browsable tree starting at the ZOPE root. My problem is that I don't know how to call/refer to the ZOPE root folder. Ex: The following creates a tree starting with the "QuickStart" tutorial folder. <!--#tree QuickStart branches_expr="objectValues('Image') or objectValues()" sort=id--> I want to start at the ZOPE root instead, so it should look something like this: <!--#tree ZopeRoot branches_expr="objectValues('Image') or objectValues()" sort=id--> ... <!--#/tree--> But "ZopeRoot" of course is not the variable name. I have tried "root", a blank value (""), a period (".") but none of these work. What is the appropriate variable name of the Zope root? Thanks, kh
Kevin Howe wrote:
Hi All,
I have created a method using the DTML-TREE tag to create a browsable tree starting at the ZOPE root. My problem is that I don't know how to call/refer to the ZOPE root folder.
Ex: The following creates a tree starting with the "QuickStart" tutorial folder.
<!--#tree QuickStart branches_expr="objectValues('Image') or objectValues()" sort=id-->
I want to start at the ZOPE root instead, so it should look something like this:
<!--#tree ZopeRoot branches_expr="objectValues('Image') or objectValues()" sort=id--> ... <!--#/tree-->
But "ZopeRoot" of course is not the variable name. I have tried "root", a blank value (""), a period (".") but none of these work. What is the appropriate variable name of the Zope root?
<dtml-in "PARENTS[-1].objectValues('Image'>" sort=id> ... </dtml-in> Will iterate over the Image objects in the zoperoot. I believe that ... branches_expr="PARENTS[-1].objectValues('Image')" ... should serve your need. Bill -- In flying I have learned that carelessness and overconfidence are usually far more dangerous than deliberately accepted risks. -- Wilbur Wright in a letter to his father, September 1900
I believe that ... branches_expr="PARENTS[-1].objectValues('Image')" ... should serve your need.
Hmm, it may not. That will show the objects contained in the root folder under every object in the tree, creating nasty infinite-tree-depth situations. I think you may want: <dtml-tree expr="PARENTS[-1]" branches_expr="objectValues('Images')"> (which I use a lot...) I wish the <dtml-tree> documentation was better. This comes up all the time on the list. It's particularly bad because, by its nature, it brings up the complicated side of Zope: aquisition, python lists, objectValues, etc. It's also a bit buggy. expand_all was broken for ages and the above doesn't work if "PARENTS[-1]" doesn't have expr= in front of it. The HTML it generates can be 'interesting', especially using the header and footer attributes, and there's practically no control over the state of the tree's expansion through DTML. Oh, and you have NO control over the formatting of the table that the tree tag produces. That aside, it's great ;-) The documentation is a ZDP issue, I think, and at some stage I'm hopefully going to have the chance to play with TreeTag.py and fix some of the things that niggle me... cheers, Chris
Hi ! Chris Withers wrote:
I wish the <dtml-tree> documentation was better. This comes up all the time on the list. It's particularly bad because, by its nature, it brings up the complicated side of Zope: aquisition, python lists, objectValues, etc.
It's also a bit buggy. expand_all was broken for ages and the above doesn't work if "PARENTS[-1]" doesn't have expr= in front of it. The HTML it generates can be 'interesting', especially using the header and footer attributes, and there's practically no control over the state of the tree's expansion through DTML. Oh, and you have NO control over the formatting of the table that the tree tag produces.
That aside, it's great ;-)
The documentation is a ZDP issue, I think, and at some stage I'm hopefully going to have the chance to play with TreeTag.py and fix some of the things that niggle me...
I am in the process of taking the Tree code apart and documenting it, but I got stuck some way down the road. If something like I did for Cookies and CatalogAware: http://zdp.zope.org/projects/zapidoc/drafts would help, then I may continue this effort. Greetings, Maik Röder
participants (4)
-
Bill Anderson -
Chris Withers -
Kevin Howe -
Maik Roeder