[Zope] Generating list of objectIDs dynamically
Casey Duncan
casey@zope.com
Tue, 30 Apr 2002 09:17:03 -0400
Folders behave like python dictionaries, so you can use that lookup synta=
x in=20
a python expression such as:
tal:define=3D"docs python:here.county[request.county].objectValues()"
You should know that this will not scale very well though. If there are m=
ore=20
than a few dozen documents in each county, performance may not be very go=
od.=20
This is because objectValues looks up every object in the folder=20
individually. If this becomes a problem, then you can use ZCatalog with a=
=20
"county" index.
hth,
-Casey
On Monday 29 April 2002 06:13 pm, Ronald L Roeber allegedly wrote:
> I am trying to generate an form option list containing documents in a=20
> folder.=20
> The folder arrangement is as follows.
>=20
>=20
> county -- Golden --- doc1
> | |=20
> | -- doc2
> |
> - Silver --- doc3
> |=20
> -- doc4
>=20
> If the user has indicated they are from "Golden" county, how do I gener=
ate=20
> the proper list of documents in the corresponding directory dynamically=
=20
> ['doc1','doc2']? If the REQUEST object includes the county=3D=3D"Golden=
", how=20
> can I do something like this (which works, but is obviously not dynamic=
):
>=20
> <form=3D"form" method=3D"post" action=3D"action"
> tal:define=3D"workingCounty request/county;
> docs here/county/Golden/objectValues()">
>=20
> How do I get the workingCounty variable to replace the "Golden" in the=20
> docs definition. This is probably simple, but I'm missing it. Thanks fo=
r=20
> any help.
>=20
> --------------------------------------------------------------------
> Ronald L. Roeber
> CIT-IANR
> University of Nebraska
> Lincoln, NE 68583 Phone: (402) 472-5630
> email: rroeber1@unl.edu=20
>=20
>=20
>=20
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -=20
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>=20