[Zope-CMF] Re: folder_contents was Re: [dev] two small changes

yuppie y.2004_ at wcm-solutions.de
Wed Feb 4 11:37:17 EST 2004


Hi!


Thanks for the feedback!

Tonico Strasser wrote:
> the new folder_contents_control.py relies on an action callded 
> folderContents.
> 
>   target = atool.getActionInfo('folder/folderContents', context)['url']
> 
> Unfortunely a skinnedFolder and maybe a lot of custom folderish Types 
> does not have this action-id.

getActionInfo is an ActionProvider method, not an ActionsTool method. 
atool.getActionInfo() does only return actions defined in portal_actions.

> There is a global action in portal_actions, but I sometimes don't need 
> this action.

What about removing the 'Visible' flag instead of deleting these 
actions? Would that work for you?

> I have a custom type, a translation. It is a scriptable type information 
> based on a skinned folder which behaves like a normal content object.
> 
> In folder_contents_control.py I did:
> 
>   if item.isPrincipiaFolderish and not item.Type() == 'Translation':
>     item_url = atool.getActionInfo('folder/folderContents', item)['url']

Ok. I see the problem.

BTW: 'folder/folderContents' should be 'object/folderContents'


1.) If 'Translation' has a folder_contents method, an invisible 
'object/folderContents' method should work.

2.) If there is a need for a general fallback to e.g. 'object/view', we 
could use something like

   try:
     item_url = atool.getActionInfo('object/folderContents', item)['url']
   except ValueError:
     ti = item.getTypeInfo()
     item_url = ti.getActionInfo('object/view', item)['url']

It would be much easier if 'object/folderContents' was defined in 
portal_types. In this case we could use

   item_url = ttool.getActionInfo( ('object/folderContents',
                                    'object/view'), item )['url']

Or if defined in the type info

   ti = item.getTypeInfo()
   item_url = ti.getActionInfo( ('object/folderContents',
                                 'object/view'), item )['url']


(These examples don't use the proposed DynamicType getActionInfo method.)

What do you think?

Cheers,
	Yuppie





More information about the Zope-CMF mailing list