[Zope-dev] BooleanIndex for ZCatalog?

Toby Dickenson tdickenson@geminidataloggers.com
Fri, 24 Mar 2000 09:21:41 +0000


On Thu, 23 Mar 2000 14:43:53 +0100, "Alexander Limi"
<alexander@limi.net> wrote:

You can implement this yourself. Provide your objects with an external
method that calculates the boolean value, and index this method with a
Field Index.

The method might look like:

def boolean_xxx(self):
    xxx = self.xxx
    return xxx and xxx not in ['off', '0', 'false']

>Hi.
>
>I would like to suggest the following addition to the ZCatalog code: A
>BooleanIndex type in addition to the existing FieldIndex, TextIndex and
>KeyIndex.
>
>The reason behind this is that Zope stores boolean 1 as "on", whereas a lot
>of other sources store them as "True" or simply "1".
>
>I ran into this problem when trying to catalog values that other programs
>had set in the ZODB. Some of them appeared as "on", some as "1", and yet
>others as "0". The last one was the one causing the trouble, as it was per
>Zope definition true, even if the value indicated false.
>
>So, I thought I would suggest that the catalog does some interpreting of the
>result when indexing boolean fields, setting the values "off", "0" and
>"false" to None, and not just do a pure "index what's contained in the
>field" like it does now. This would IMHO best be done with a new Index
>called BooleanIndex.
>
>If this sounds totally unacceptable, feel free to ignore my post - I'm a
>clueless newbie relaying my initial problems to the zope list as I find them
>:)
>
>Regards,
>
>
>Alexander Limi
>PS: CC any answers to me, as I'm not really qualified to be on the
>zope-dev-list :)
>
>
>_______________________________________________
>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 )


Toby Dickenson
tdickenson@geminidataloggers.com