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
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 id><br/> </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 phil.harris@zweb.co.uk ----- Original Message ----- From: <brocken22@gmx.de> To: <zope@zope.org> 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 - Zope@zope.org 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 )
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 id><br> </dtml-in> ----- Original Message ----- From: <brocken22@gmx.de> To: <zope@zope.org> 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 - Zope@zope.org 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 )
Phil Harris wrote:
<dtml-in "objectItems()"> <dtml-if "meta_type=='Folder'"> <dtml-call "restrictedTraverse(_['id']+'/iterate')(_.None,_)"> </dtml-if> <dtml-var id><br> </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 id><br> </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 ;-)
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
On Wed, 27 Sep 2000 brocken22@gmx.de 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'"> <li><dtml-var id> </dtml-if> <dtml-if "meta_type == 'Folder'"> <li><dtml-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:jeff.hoffman@goingv.com Going Virtual, L.L.C. http://www.goingv.com/
Hi I'm using the Photo product, instances of which I can call, with arguments, like this: <dtml-var "my_photo(display='thumbnail')"> However, I can't work out how to pass arguments to each sequence item when iterating over a sequence. For example, I've tried: <dtml-in objectValues(['Photo'])"> <dtml-var "_['sequence-item'](display='thumbnail')"> </dtml-in> (..not that I expect that to work :) And I get Error Type: TypeError Error Value: call of non-function (type string) I've tried various combinations of ways of calling the sequence-item, but they all return the same error. Could anyone suggest how I should do this? Thanks in advance... Seb
participants (5)
-
brocken22@gmx.de -
Chris Withers -
Jeff Hoffman -
Phil Harris -
seb