[Zope] hard dtml syntax problem
Jerome Alet
alet@unice.fr
Thu, 13 Jul 2000 10:39:30 +0200 (MET DST)
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:
>
> ROOT
> 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']) """ )">
...
</dtml-let>
My actual solution is to do :
<dtml-let myresult="ZopeFind(this(), obj_metatypes=['Folder'],
search_sub=1)">
<dtml-if "not objectValues(['Folder'])">
...
</dtml-if>
</dtml-let>
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 - alet@unice.fr - 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