On Thu, 13 Jul 2000, Bill Anderson wrote:

> Jerome Alet wrote:
> > > >
> > > > Hi want to call ZopeFind to find all folders in the current folder which
> > > > doesn't have got any subfolder.

Sorry, I should have added : recursively !!!

> I'm confused. You said you only were concerned about the _current_
> directory's subdirectories not having sub-directories, right? IOW You
> have:
>  FolderA
>   -FolderA1
>   -FolderA2
>    /FolderA2A
>  FolderB
>  FolderC
> And in ROOT, you only want to see :
> FolderB
> FolderC
> And in FolderA:
> FolderA1
> Right? 

No, what I want is the following list (with your example):

['FolderA1', 'FolderA2A', 'FolderB', 'FolderC']

> > I'm sure I can do it with ZopeFind, because Zope do it in the Find
> > (Advanced) tab, but don't know the exact syntax of:
> > 
> > """ obj_expr = "not objectValues(['Folder'])" """
> > 
> > (which doesn't work because of nested " and ')
> > 
> > Actually I've put a <dtml-if> inside of my <dtml-in> loop, but it limits
> > my possibilities, especially because my result length is overestimated
> > (all folders vs only folders with no subfolders).
> Maybe I read it wrong, but I thought you said you wanted only folders
> with subfolders _in the current directory_.
> Maybe you need to rephrase your question?

Yes I'm sorry:

>From a Folder, I want to recursively search for all "terminal" folders
(leaves) and build a list of these folders.

bye "terminal" folder, I mean a folder with no subfolder.

The following should give me exactly the result I want, if only I knew how
to write it in a way accepted by the dtml parser: 

<dtml-let myresult="ZopeFind(this(), obj_metatypes=['Folder'],
search_sub=1, obj_expr=""" not objectValues(['Folder']) """ )">

My actual solution is to do :

<dtml-let myresult="ZopeFind(this(), obj_metatypes=['Folder'],
  <dtml-if "not objectValues(['Folder'])">

but this solution is not good because if I need len(myresult) it returns
me the total number of folders, not the number of "terminal" folders, and
I find it stupid to have to build a new list in a <dtml-in> and then
loop over the new list in a second <dtml-in> because I know ZopeFind is
the solution: can do it, I've tested it with the Find tab.

My only problem is: What is that f... syntax ? 

Any DTML Syntax guru out there ?

thanks in advance.

Jerome ALET - [EMAIL PROTECTED] - http://cortex.unice.fr/~jerome
Faculte de Medecine de Nice - http://noe.unice.fr - Tel: 04 93 37 76 30 
28 Avenue de Valombrose - 06107 NICE Cedex 2 - FRANCE

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to