Re: [Zope] hard dtml syntax problem

2000-07-15 Thread Bill Anderson

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.

___
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] hard dtml syntax problem

2000-07-13 Thread Jerome Alet

On Wed, 12 Jul 2000, ethan mindlace fremen wrote:

 Jerome Alet wrote:
  
  Hi want to call ZopeFind to find all folders in the current folder which
  doesn't have got any subfolder.
  
  the following query works but returns all folders, even those which have
  got subfolders:
  
  dtml-let myresult="ZopeFind(this(), obj_metatypes=['Folder'],
  search_sub=1)"
  dtml-in myresult
  ...
  /dtml-in
 
 Couldn't you just do a nested dtml-in?  It's kind of hacky, but...
 
 dtml-in "objectValues(['Folder']"
  dtml-in "objectValues(['Folder']"

No this can't help because I don't know how deep is my hierarchy: I've
delegated folder creations to at least ten persons.

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).

thanks anyway for your answer.

bye,

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]
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] hard dtml syntax problem

2000-07-13 Thread Bill Anderson

Jerome Alet wrote:
 
 On Wed, 12 Jul 2000, ethan mindlace fremen wrote:
 
  Jerome Alet wrote:
  
   Hi want to call ZopeFind to find all folders in the current folder which
   doesn't have got any subfolder.
  
   the following query works but returns all folders, even those which have
   got subfolders:
  
   dtml-let myresult="ZopeFind(this(), obj_metatypes=['Folder'],
   search_sub=1)"
   dtml-in myresult
   ...
   /dtml-in
 
  Couldn't you just do a nested dtml-in?  It's kind of hacky, but...
 
  dtml-in "objectValues(['Folder']"
   dtml-in "objectValues(['Folder']"
 
 No this can't help because I don't know how deep is my hierarchy: I've
 delegated folder creations to at least ten persons.

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? If so, whether or not FolderA1 has subfolders is irrelevent in
root. The code ethan posted will provide you with that. I have very
similiar code for one of my nav-systems, opnly it is the opposite, I
show folders (and various other objects) and their subfolders (and
various other objects) only.

 
 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?


Bill

-- 
"Linux: the operating system with a CLUE...
Command Line User Environment".

seen in a posting on comp.software.testing

___
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] hard dtml syntax problem

2000-07-13 Thread Jerome Alet

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 - [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]
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] hard dtml syntax problem

2000-07-12 Thread ethan mindlace fremen

Jerome Alet wrote:
 
 Hi want to call ZopeFind to find all folders in the current folder which
 doesn't have got any subfolder.
 
 the following query works but returns all folders, even those which have
 got subfolders:
 
 dtml-let myresult="ZopeFind(this(), obj_metatypes=['Folder'],
 search_sub=1)"
 dtml-in myresult
 ...
 /dtml-in

Couldn't you just do a nested dtml-in?  It's kind of hacky, but...

dtml-in "objectValues(['Folder']"
 dtml-in "objectValues(['Folder']"
 dtml-else
  pdtml-var title_or_id has no folders.
 /dtml-in
/dtml-in

you may or may not have to change the dtml-var statement to get the
correct title-or-id.

Hope that helps,
-- 
ethan mindlace fremen
Zopatista Community Liason
Abnegate I!

___
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] hard dtml syntax problem

2000-07-11 Thread Jerome Alet

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

the following query works but returns all folders, even those which have
got subfolders:

dtml-let myresult="ZopeFind(this(), obj_metatypes=['Folder'],
search_sub=1)"
dtml-in myresult
...
/dtml-in

So I play a little with the Zope Search Interface and I find that if I
type in "not objectValues(['Folder']" (without the double quotes) in the
obj_expr (Expression) field then this solves my problem.

my question is:

How to rewrite my ZopeFind with obj_expr="not objectValues(['Folder'])" ?

I've tried with or without quotes (single, double and even triple ones),
but with no luck: I've always got a Document Template Parse Error.

What is the correct syntax please ?

Actually I've added a test inside my dtml-in loop but I think it's stupid
because I need the exact result length and I don't want to rebuild a list
of matching results since the Zope Search Interface can do it.

thanks in advance for any answer.

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]
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 )