[ZPT] determining the value of a folder's property

robert robert@redcor.ch
Sun, 6 Apr 2003 08:23:04 +0200


 <li tal:condition=3D"subfolder/navigation | nothing">
avoids an error when navigation does not exist.

to have the folders sorted on an other field than the name you have to crea=
te=20
your own routine in a python script you have to call yourself like:
 <span tal:repeat =3D "subfolder=20
python:here.mysortscript(here.objectValues('Folder'))">

assuming your script has a paramater folders in which you pass the folders =
to=20
sort:

names=3D[]
result=3D[]
for folder in folders:
    names.append(folder.theFieldIWant)
names.sort()
for name in names:
      result.append(dic[name])
return result

HTH
robert

Am Sonntag, 6. April 2003 04:41 schrieb Jamie:
> I have a Dynamic folder driven navigation system set up using this:
>
> <UL>
> <li tal:condition=3D "python:len(request.PARENTS) > 2" ><a href=3D
> "..">Return
> to parent</a></li>
>
> <span tal:repeat =3D "subfolder python:here.objectValues('Folder')">
> <li tal:condition=3D"subfolder/navigation">
> <a tal:attributes=3D "href subfolder/absolute_url"
>    tal:content=3D "subfolder/title_or_id">
>    link to subfolder
> </a>
> </li>
> </span>
> </ul>
>
> I have added a Boolean property (navigation) to all of my folders which
> lets me determine whether a folder should show up in my menu. If I
> create a folder without the navigation property it gives me an error. Is
> there a way to avoid this, because I would like to have some folders not
> have this property at all.
>
> Also, I need a way to sort the folders that show up in the menu other
> than alphabetically.
>
> Thanks for your time,
>
> Jamie White
>
> Jamie@brobus.net

=2D-=20
mit freundlichen Gr=FCssen

Robert Rottermann
www.redCOR.ch