[Zope-CMF] DEV: _morphSpec

Tres Seaver tseaver@zope.com
01 Nov 2002 12:53:49 -0500


On Thu, 2002-10-31 at 22:22, alan runyan wrote:
> erm. it seems the default for contentValues() spec argument
> is suppose to be meta_type's not portal_types.  this could
> easily be changed in _morphSpec().  when it called
> portal_types its saying filter using meta_type's only.  
> 
> Is this really desired default behavior?  This means all
> "repurposed" content could only be queried by passing
> the meta_type and then doing extra filtering.  
> 
> I would propose that we call listContentTypes() with
> no arguments.

The 'spec' argument is primarily there for backward compatibility.  The
'_filteredItems' method is the primary means of getting better results
from 'contentValues', 'contentIds', and 'contentItems'.  E.g.:

  <div tal:define="filtered python: here.contentValues(
                                     filter={'Subject':'foo'} )">
  <p tal:repeat="val filtered"
     tal:content="val/Title">TITLE HERE</p>
  </div>

Please look at the ContentFilter class at the bottom of
CMFCore/PortalFolder.py;  it permits filtering on a variety of
values, including 'portal_type'.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com