[Zope-CMF] listFolderContents vs. objectValues

Tres Seaver tseaver@zope.com
10 Jul 2003 08:09:10 -0400


On Thu, 2003-07-10 at 03:48, Maciej Zarski wrote:
> Hello,
> 
> I am new to Zope/CMF and I couldn't find any good (and up to
> date) documentation for CMF. 
> 
> I am trying to dynamically create menu from directory structure.
> I am using a customized version of main_template. I tried two
> options:
> 
> 1) <... tal:repeat="portal_object.objectValues('Folder')" >

Try:

     <... tal:repeat="folder portal_object.contentValues('Folder')" >

because:

  - tal:repeat needs to have an iteration variable (you probably
    really already knew this, or else your templates wouldn't
    even compile).

  - 'objectValues' is the "stock" Zope API, and takes one or a sequence
    of meta_types;  'contentValues' is the CMF cognate, which takes one
    or a sequence of portal_types.  The objects you are interested in
    are likely CMF PortalFolders, which have a meta_type of 'Portal
    Folder' and a portal_type (by default) of 'Folder'.

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