[Zope] Name of top level folder

Martijn Pieters mj@antraciet.nl
Sun, 13 Jun 1999 12:49:37 +0200


At 12:32 11-6-99 , Alex.Thomas@dresdnerkb.com wrote:
>Next challenge is to be a bit more selective about which documents are
>displayed in the tree. For instance, could I not include objects with a
>'dontIndex' property set by filtering the list that ObjectValues returns? No
>idea how to code this, probably something to do with map or apply sorta
>things, if anyone has the answer to hand this should keep me quiet for a
>bit!

If the objetcs you want to exclude are documents, you could differntiate
between DTML Methods and DTML Documents, and have objectValues only return
one ore the other. 

If the objects must be the same type (for example, Folders), you must use
an External Method. That external method can then filter the list or just
create the list itself, before passing it back to the #tree tag object. If
the External Method doesn't have any arguments, you can call it with the
branches="" attribute, otherwise you'll have to use branches_expr="".

I didn't test this, but you could maybe define a meta_type property on a
Folder. The objectValues, objectItems and objectIds methods filter on that
property. Defining the property on a Folder might override the default
value of 'Folder'. You can then instruct objectValues to only return
objects of type 'TreeFolder' or something. I don't know if 1) you can
override the property, and 2) what the side effects will be. YMMV.

In Zope 2, you could subclass Folders using ZClasses, and only change the
meta_type.

-- 
Martijn Pieters, Web Developer 
| Antraciet http://www.antraciet.nl 
| Tel: +31-35-7502100 Fax: +31-35-7502111 
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj 
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 
------------------------------------------