[Zope] Displaying all subobjects
The second dumb question today:It's a horrible one How to iterate over all subfolders? "objectValues" shows only the same level, where the method resides. Thanks. -- Sent through GMX FreeMail - http://www.gmx.net ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Displaying all subobjects
How about, Woah there boy! This is completely untested and untried in any way, caveat emptor!! create an dtml-method called iterate: with this contents: dtml-in "objectItems()" dtml-if "meta_type == 'Folder'" dtml-call "id['iterate']" /dtml-if dtml-var idbr/ /dtml-in The you can call this like so, from any other DTML_XXX: dtml-var iterate or dtml-var "this()['iterate']" Or .. hth Phil [EMAIL PROTECTED] - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 27, 2000 11:20 AM Subject: [Zope] Displaying all subobjects The second dumb question today:It's a horrible one How to iterate over all subfolders? "objectValues" shows only the same level, where the method resides. Thanks. -- Sent through GMX FreeMail - http://www.gmx.net ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Displaying all subobjects
Actually, This would probably work a bit better (since the last one doesn't work at all 9¬) ) dtml-in "objectItems()" dtml-if "meta_type=='Folder'" dtml-call "restrictedTraverse(_['id']+'/iterate')(_.None,_)" /dtml-if dtml-var idbr /dtml-in - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 27, 2000 11:20 AM Subject: [Zope] Displaying all subobjects The second dumb question today:It's a horrible one How to iterate over all subfolders? "objectValues" shows only the same level, where the method resides. Thanks. -- Sent through GMX FreeMail - http://www.gmx.net ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Displaying all subobjects
Phil Harris wrote: dtml-in "objectItems()" dtml-if "meta_type=='Folder'" dtml-call "restrictedTraverse(_['id']+'/iterate')(_.None,_)" /dtml-if dtml-var idbr /dtml-in How about this untested: dtml-in "objectItems()" dtml-if "meta_type=='Folder'" dtml-with sequence-item dtml-var iterate /dtml-with /dtml-if dtml-var idbr /dtml-in cheers, Chris PS: I find this sort of thing is often best done in an external method. Or a python product (see the __call__ thread on zope-dev for all the fun you can have there ;-) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Displaying all subobjects
Hallo Chris, thanks for the quick reply, but the method is displaying all the objects in the folder and I'd like to get only one metatype of objects(i.e.ZClass-cars)but for all levels. -- Sent through GMX FreeMail - http://www.gmx.net ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Displaying all subobjects
On Wed, 27 Sep 2000 [EMAIL PROTECTED] wrote: Hallo Chris, thanks for the quick reply, but the method is displaying all the objects in the folder and I'd like to get only one metatype of objects(i.e.ZClass-cars)but for all levels. Try creating a DTML Method called 'iterate' (tested): ul dtml-in objectItems dtml-if "meta_type == 'DTML Method'" lidtml-var id /dtml-if dtml-if "meta_type == 'Folder'" lidtml-var id dtml-var "_['sequence-item'].iterate(_['sequence-item'], _)" /dtml-if /dtml-in /ul The first dtml-if, the one comparing for meta_type == 'DTML Method', is the one where you specify what you're looking for. In this example, it's looking for DTML Methods. Change it to 'cars', if that's what you want. --Jeff --- Jeff K. Hoffman 704.849.0731 x108 Chief Technology Officer mailto:[EMAIL PROTECTED] Going Virtual, L.L.C. http://www.goingv.com/ ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )