[Zope] Sort in tree tag

Oliver Bleutgen Oliver Bleutgen <myzope@gmx.net>
Fri, 12 Oct 2001 18:06:44 +0200


> Hello,
> I'd like to sort the folders in my tree tag by a property index.

> The problem is that not every folder has this property.
> So when I do
> <tree ... sort=index>
> I get an error, when a folder does not have that property index.
> How can I avoid that error?
> I'd like to do s. th. like
> <tree ... (sort=index missing=0)>

write a small script (python),
get_index


try:
    my_index = context.index
except:
    my_index = 0
return my_index

now with
<tree .. sort=get_index>


and the magic of acquisition,
it should work.

cheers,
oliver