[Zope] - "folderish"?

Rhys Jones rhys@securetrading.com
Tue, 15 Dec 1998 17:39:41 -0000


> On Tue, 15 Dec 1998 skip@calendar.com wrote:
>
> >
> >     >> I haven't even found a simple way of figuring out if a PATH_INFO
> >     >> component is a Folderish object or not.
> >
> >     Jim> <!--#if "foo.isPrincipiaFolderish"-->
> >
> > Pardon my ignorance, but what is "folderish"?  In general, I
> think there is
> > a getting to be a fair bit of unique nomenclature flying about
> on the list
> > that is going to undermine attempts of newbies to understand
> what's what.
>
> A Folderish object (I am new to Zope too so I might be wrong) is a Zope
> object that can contain other Zope objects, properties etc in contrast to
> Documents which are methods of Folderish objects and cannot contain other
> objects. Documents do have attributes but you cannot add new attributes
> which is what I need at this point.

The isPrincipiaFolderish attribute is used by the tree tag. The tag calls
the tpValues method of an object to get its list of branches - it's this
code that checks for isPrincipiaFolderish to see if a branch is folderish.

tpValues is implemented in the standard Folder, as well as in add-on
Products. Here's such a code snippet for tpValues, building a list of
folderish branches r:

       for id in self._objects:
           o=getattr(self, id['id'])
           try:
               if o.isPrincipiaFolderish: r.append(o)
           except: pass


The great thing about the tree tag is that you can give it another method to
use rather than the default tpValues (and its use of isPrincipiaFolderish).

The dtml guide gives an example of <!--#tree branches=objectValues--> for a
tree that displays all sub-objects of a folder, not just those which are
folderish. Custom Products can define other methods, which can check their
own attributes (e.g. 'live' folders, etc.) of folderish-ness.

Rhys