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

yuppie y.2004_ at wcm-solutions.de
Wed Feb 4 12:10:36 EST 2004


Oops! I have to correct myself: 'folder', not 'object'!

yuppie wrote:
> BTW: 'folder/folderContents' should be 'object/folderContents'

'folder/folderContents' *is* correct.

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

... 'folder/folderContents' method should work.

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

... 'folder/view' ...

> 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']

   try:
     item_url = atool.getActionInfo('folder/folderContents', item)['url']
   except ValueError:
     ti = item.getTypeInfo()
     item_url = ti.getActionInfo('folder/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']

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

> Or if defined in the type info
> 
>   ti = item.getTypeInfo()
>   item_url = ti.getActionInfo( ('object/folderContents',
>                                 'object/view'), item )['url']

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


Sorry for the confusion,
	Yuppie






More information about the Zope-CMF mailing list