[Zope] hard dtml syntax problem
Bill Anderson
bill@libc.org
Sat, 15 Jul 2000 15:18:25 -0600
Jerome Alet wrote:
>
> 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 !!!
Ahh, big difference! :-)
[...]
> 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 ?
Personally, something like this I would do in python. IMO, deep
recursion belongs in python,not DTML.
--
Do not meddle in the affairs of sysadmins, for they are easy to annoy,
and have the root password.