[Zope-CMF] Re: folder_contents was Re: [dev] two small changes
Tonico Strasser
contact_tonico at yahoo.de
Wed Feb 4 13:11:25 EST 2004
yuppie wrote:
> Hi!
[...]
>> 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 find the global setting in the actions tool is not good. I think a
normal object shouldn't have a folder_contents action by default. It's
confusing and if I would repeat this logic for custom types, things
would get complicated. But thats just my view. Removing the visible flag
(or deleting the action) is not an option, because I want to be as
compatible as possible with plain CMF.
>> 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.
How? As you mentoined before:
> getActionInfo is an ActionProvider method, not an ActionsTool method.
> atool.getActionInfo() does only return actions defined in portal_actions.
Ah, do you mean in portal_actions? Hmm.
> 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']
>
FWIW. Kann nicht schaden.
> 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?
Looks good. What about adding object/folderContents to Folder and
Skinned Folder?
Tonico
More information about the Zope-CMF
mailing list