[Zope3-dev] possible bug in catalog code

Dieter Maurer dieter at handshake.de
Thu Jul 7 13:30:25 EDT 2005


Jim Fulton wrote at 2005-7-7 06:55 -0400:
> ...
[Martijn]
>> The following sequence I think leads to trouble:
>> 
>> 
>>         value = getattr(object, self.field_name, None)
>>         if value is None:
>>             return None
>> 
>> as this means attributes that do exist and have the value None would 
>> never be indexed (as index_doc() is never reached).
> ...
[Jim]

>I'm not sure if this is a bug.  If it is, the fix might be worse.
>It makes no sense and could cause problems to use None as a BTree-bases
>index key. AFAICT, Python still makes no guarantee wrt comparison of
>of objects of different types over time:

The current Python falls back to order by type name and than by id.
I do not expect this to change again.

However, there is an additional reason not to put "None" into a BTree.

  Its interface has a weekness in its "keys", "values", "min" and "max"
  methods.

  E.g. in "keys(min,max)", "min=None" or "max=None" mean: no restriction.

  Therefore, they cannot distinguish between a "None" stored in the
  BTree itself and the use of "None" as "no restriction".


-- 
Dieter


More information about the Zope3-dev mailing list