[Zope-CMF] Re: [PTK(286)[2] resolved] Re: 'portal file' and 'portal image'

Tres Seaver tseaver@digicool.com
Tue, 5 Jun 2001 17:50:04 -0400 (EDT)


On Tue, 5 Jun 2001, Lucas Hofman wrote:

> Tres,
> 
> Could the problem be in CMFCore/dtml/catalogFind.py:
> 
> <dtml-in expr="portal_types.listContentTypes()">
>   <option value="&dtml-sequence-item;"> &dtml-sequence-item; </option>
> </dtml-in>
> <dtml-in all_meta_types mapping>
>   <option value="<dtml-var name html_quote>"> <dtml-var name> </option>
> </dtml-in>
>  
> I can imagine listContentTypes() to return portal_types instead of
> metatypes.
> 
> But will this not generate double enties in the listbox. In other words:
> will all_meta_types not include the metatypes defined by the CMF
> classes? 

Excellent detective work.

The catalog's search mechanism needs to know about the "Zope
meta_type", not the "CMF Content Type"; I have extended the
'CMFCore.interfaces.portal_types' interface to cover the
'listContentTypes' method, documenting two new optional
arguments::

    def listContentTypes( self, container=None, by_metatype=0 ):
        """
            Return list of content types, or the equivalent
            metatypes;  if 'container' is passed, then filter
            the list to include only types which are addable in
            'container'.
        """

and have implemented it in CMFCore.TypesTool.  I also removed
the homonymic method from PortalFolder.  The catalog tool's
metatype list now invokes 'listContentTypes' passing
'by_metatype=1', which makes all content types findable, assuming
that their 'metatype' property is correctly populated.

The CVS head now has these changes.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@digicool.com
Digital Creations     "Zope Dealers"       http://www.zope.org