[Zope-dev] ZCatalog problems

Chris McDonough chrism@digicool.com
Mon, 26 Feb 2001 14:54:22 -0500


Neat!

----- Original Message ----- 
From: "Steve Alexander" <steve@cat-box.net>
To: "Morten W. Petersen" <morten@esol.no>
Cc: <zope-dev@zope.org>
Sent: Monday, February 26, 2001 1:31 PM
Subject: Re: [Zope-dev] ZCatalog problems


> Morten W. Petersen wrote:
> 
>  > Hi guys,
>  >
>  > I'm having trouble making ZCatalog work.  The problem is that there
>  > are 29 objects of a given meta type, with the same booleans that
>  > should be returned for an iteration; but only 20 are.  Is this a
>  > result of caching perhaps?  Or lazy results?
> 
> Could be that your objects have different ideas of what are proper 
> boolean values.
> 
> I assume you're using a FieldIndex. Try calling 
> uniqueValuesFor(index_name) to see what values are stored. You may find 
> that you have 0, 1, '1' and '', for example.
> 
> In situations like that, I get the unique values, then construct a query 
> for the catalog based on the true or false values.
> 
> To get the true values, something like
> 
>    Catalog(boolean_index=
>         filter(None, Catalog.uniqueValuesFor('boolean_index'))
> 
> To get the false ones:
> 
>    Catalog(boolean_index=
>          filter(lambda x: not x,
>                 Catalog.uniqueValuesFor('boolean_index'))
> 
> --
> Steve Alexander
> Software Engineer
> Cat-Box limited
> 
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )
>