[Zope] horrible ZCatalog kludge
Chris McDonough
chrism@zope.com
Sun, 14 Jul 2002 00:30:05 -0400
Here's an even better way, but you might need to do it in an external
method (it may be unavailable in TTW scripts):
index = catalog['Indexes'].nominator
l = map(None, index.uniqueValues())
----- Original Message -----
From: "Kyler Laird" <Kyler@Lairds.com>
To: <brinegar@purdue.edu>; <cnd@purdue.edu>; <sydelko@purdue.edu>
Cc: <zope@zope.org>
Sent: Saturday, July 13, 2002 7:28 PM
Subject: [Zope] horrible ZCatalog kludge
> O.k., so I want to know how to get a list of all objects
> in a ZCatalog for which some variable has a non-null
> value. A star (*) by itself doesn't work, so how to do
> it? Well, here's my kludge...
>
> catalog = container.people.catalog
>
> values = []
> for value in catalog.uniqueValuesFor('nominator'):
> if value:
> values.append(value)
> print len(catalog(nominator=values))
>
> I feel so dirty...
>
> --kyler
>
>
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>