[Zope] horrible ZCatalog kludge

Casey Duncan casey@zope.com
Sun, 14 Jul 2002 01:53:57 -0400


Not so much dirty, but slow and not very scalable.

See newly minted recipe:

http://www.zopelabs.com/cookbook/1026625784

hth,

-Casey 

----- 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 )
>