[Zope-CMF] REQ: Make detecting Folder-like objects explicit.

Tres Seaver tseaver@zope.com
Thu, 06 Sep 2001 08:30:44 -0400


Kent Polk wrote:

> On 5 Sep 2001 17:20:00 -0500, Ulrich Eck wrote:
> 
>>While surfing through the sources of CMF i found the following part in the portal_actions tool:
>>
>>Line 165 ActionsTool.py:
>>
>>    def listFilteredActionsFor(self, object=None):
>>
> 
>>This part basically defines if the "folder_contents" action will be displayed in
>>the actions-box.
>>
>>wouldn't it be better to provide a function e.g. isFolderish() for every portal object
>>instead of directly accessing the <obj>.isPrincipiaFolderish attribute ??
>>(like getId, manage_options() ...)

The canonical way to do this kind of checking is going be to check

the object's interface assertions, e.g.::

   from Interface import objectImplements
   import OFS.Folderish

   ...

   if OFS.Folderish in objectImplements( object ):
      ...

where 'OFS.Folderish' is a hypothetical interface object.  We will
have these interface assertions available as the "component
architecture",
   http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture
lands.


>>
>>I see these applications that might need such a thing:
>>
>  
> 
>> - Recently I saw a Proposal of CompoundDocuments, that need to be folderish, but
>>   should they show up as a folder if Reviewers/Users browses the folder_contents
>>
> 
> This is exactly the problem I ran into with my folderish objects,
> and what I thought the SkinnedFolders was supposed to alleviate.
> (This very method is what got me in trouble).
> 
> Unfortunately, I haven't managed to get back to working on those
> yet. So are you saying that you can't override the behavior for
> SkinnedFolders here?


The ActionsTool is being over-helpful here:  it is trying to

determine whether to display the 'folder_contents' link (which
it does almost everywhere), and if so, what the URL should be
(is it relative to the current context or to its parent?)

So, as Jens pointed out to me yesterday afternoon, there is no
way to "turn off" the 'folder_contents' link using the stock
ActionsTool.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com