[Zope-dev] range:min bug in ZCatalogs fo Zope 2.3.2

Johan Carlsson [Torped] johanc@torped.se
Thu, 21 Mar 2002 11:51:09 +0100


Hi,
I have encountered a strange problem with ZCatalogs in Zope 2.3.2.

We have objects having DateTime arguments effective_date and expiration_date
that gets indexed in different ZCatalogs. (The index is a field index).

We then tries to get all published objects that have not yet been archived:

now=_.DateTime()
Service.searchResults(
     effective_date =now, effective_date_usage='range:max'
     , expiration_date =now, expiration_date_usage='range:min'
)


Now this works fine, until one day when result searchResults returns an 
empty result list
which is not expected.
It seems to be that some days the range:min statement doesn't work correctly.
(I tried with different range:* combinations and the only thing I found not 
working
is the range:min statement (some days).

If I instead use a different value for now:

now2 = _.DateTime(now.Date())  # now.Date()  returns somethong like 
"2002/03/21" which in turn makes the now2 equal to the DateTime value 
"2002/03/21 00:00:000 GMT+1" (GMT+1 is my local TimeZone)

Now using now2 in:

Service.searchResults(
     effective_date =now, effective_date_usage='range:max'
     , expiration_date =now2, expiration_date_usage='range:min'
)

will always result in a list (all though it gets quantized to midnight the 
resulting list will be somewhat biased).

What I don't seem to understand is that DateTime() and 
DateTime(DateTime().Date) gets so different results.

Have anyone seen something like this before?

Best Regards,
Johan Carlsson




-- 
Johan Carlsson, Torped AB

http://www.torped.se -- http://easypublisher.torped.se