[Zope-CMF] REQ: Make detecting Folder-like objects explicit.
Ulrich Eck
ueck@net-labs.de
Wed, 5 Sep 2001 23:17:56 +0200
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):
'''Gets all actions available to the user and returns a mapping
containing user actions, object actions, and global actions.
'''
portal = aq_parent(aq_inner(self))
if object is None or not hasattr(object, 'aq_base'):
folder = portal
else:
folder = object
# Search up the containment hierarchy until we find an
# object that claims it's a folder.
while folder is not None:
if getattr(aq_base(folder), 'isPrincipiaFolderish', 0):
# found it.
break
else:
folder = aq_parent(aq_inner(folder))
info = ActionInformation(self, folder, object)
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() ...)
I see these applications that might need such a thing:
- I'm working on CMFApplications, that behave like content-objects and allow
small Applications like an LDAP-based Addressbook, MailClient etc.
that need to be folderish (e.g. if they are based on a Specialist) otherwise the
management-interface won't let the user browse the tree for Racks for example.
but they should show up like a Document in folder_contents.
- 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
What do other CMF-Product Developers think on this issue ??
thanks for your replies
Ulrich Eck
net-labs