[ZPT] determining the value of a folder's property
Tamir Halperin
tamir@brobus.net
Sun, 6 Apr 2003 03:05:49 -0400
thx, Robert.
Would the sorting of the folders also be possible using dtml? Imagine =
another property, in addition to "navigation". Let's call it "navsort". =
Is it possible to use dtml somehow to retrieve the folders based on the =
value of the navsort proerty?
> -----Original Message-----
> From: robert [mailto:robert@redcor.ch]
> Sent: Sunday, April 06, 2003 1:23 AM
> To: Jamie; zpt@zope.org
> Subject: Re: [ZPT] determining the value of a folder's property
>=20
>=20
> <li tal:condition=3D"subfolder/navigation | nothing">
> avoids an error when navigation does not exist.
>=20
> to have the folders sorted on an other field than the name=20
> you have to create=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'))">
>=20
> assuming your script has a paramater folders in which you=20
> pass the folders to=20
> sort:
>=20
> names=3D[]
> result=3D[]
> for folder in folders:
> names.append(folder.theFieldIWant)
> names.sort()
> for name in names:
> result.append(dic[name])
> return result
>=20
> HTH
> robert
>=20
> 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=20
> 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=20
> an error. Is
> > there a way to avoid this, because I would like to have=20
> some folders not
> > have this property at all.
> >
> > Also, I need a way to sort the folders that show up in the=20
> menu other
> > than alphabetically.
> >
> > Thanks for your time,
> >
> > Jamie White
> >
> > Jamie@brobus.net
>=20
> --=20
> mit freundlichen Gr=FCssen
>=20
> Robert Rottermann
> www.redCOR.ch
>=20
>=20
> _______________________________________________
> ZPT mailing list
> ZPT@zope.org
> http://mail.zope.org/mailman/listinfo/zpt
>=20