[Zope-CMF] Re: modifying TypeInformation's properties
Jean-Marc Orliaguet
jmo at ita.chalmers.se
Thu Sep 2 20:39:10 EDT 2004
yuppie wrote:
> Hi!
>
>
> Florent Guillaume wrote:
>
>> Standard use case: flagging certain types for certain kind of
>> operations in the portal. For instance I want to only display certain
>> content types in some menus (like in advanced search:
>> cps_is_searchable). Or I want to add some types (portlets) in some
>> menus. Or I want to flag some types as being displayed in the
>> "folderish" parts of a folder listing, and others as "documentish"
>> (cps_display_as_document_in_listing, to have a view that presents
>> folders at top then documents).
>>
>> For all these, the natural place to add information is on the TI
>> object itself.
>
>
> Still trying to understand the use cases:
>
> How are these flags configured, e.g. if I want to write a content type
> that should work with CPS? Can I set the properties as part of the fti
> data in my product? Can I set them in the Types Tool TTW? Or does a
> CPS tool set them, using properties like annotations?
>
>
> Cheers,
> Yuppie
Hi!
when you have portal types that are all derived from the same base type
you want to be able to tag them as belonging to a same given category,
for instance portlets are all derived from a CPSPortlet.py class and
'cps_is_portlet' is being used to identify them.
security.declarePublic('listPortletTypes')
def listPortletTypes(self):
"""Return the list of all defined portal_types which are portlets
It means having the 'CPS Portlet' flag
"""
ttool = getToolByName(self, 'portal_types')
returned = []
for id in ttool.objectIds():
fti = getattr(ttool, id)
if getattr(fti, 'cps_is_portlet', 0) == 1:
returned.append(id)
return returned
how would you do otherwise? use a dummy action called 'isportlet' ?.
regards
/JM
More information about the Zope-CMF
mailing list