[Zope] recursive folder listing
Casey Duncan
cduncan@kaivo.com
Thu, 19 Jul 2001 14:00:42 -0600
"wazum-mail (wolfgang)" wrote:
>
> hiya!
>
> I can't solve this problem ... hmmm ..
>
> I need a menu in a select list with
> all folders listed that have an attribute called
> "in_the_list" (boolean, 1)
>
> this dtml method ("list_values") is called from
> another dtml method and calls itself recursively:
>
> <dtml-in "objectValues (['Folder'])" skip_unauthorized>
> <dtml-if "_.hasattr(_['sequence-item'], 'in_the_list')">
> <option value="<dtml-var "absolute_url()">"><dtml-var title_or_id>
> <dtml-with sequence-item only>
> <dtml-var list_values>
> </dtml-with>
> </dtml-if>
> </dtml-in>
>
> but this doesn't work ...
> I think this is an aquisition problem (?) but I'm not
> able to solve it ...
>
> your help is highly appreciated!
>
> thx & tia
>
> Wolfgang
>
I would personally do this in a Python script. But, here is a way in
DTML. Basically, you can access properties without worrying about
acquisition by using the hasProperty and getProperty methods of the
Folder. Something like:
<dtml-in expr="objectValues('Folder')" skip_unauthorized>
<dtml-if expr="getProperty('in_the_list', 0)">
do stuff
</dtml-if>
</dtml-in>
You don't need the _['sequence-item'] stuff because dtml-in already puts
the current object at the top of the namespace stack for you.
hth,
--
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>