[Zope-dev] range:max, date times and pluggableindexes

Casey Duncan casey@zope.com
Thu, 2 May 2002 11:17:48 -0400


On Thursday 02 May 2002 10:48 am, Lennart Regebro allegedly wrote:
> In Zope 2.3.3 we did this with ZCatalog, on a field index:
>=20
>             query['effective_date'] =3D ['', DateTime.now()]
>             query['effective_date_usage'] =3D 'range:max'
>=20
> This returns all records where the effective_date is lower than todays =
date
> OR the effective_date is an empty string.
>=20
> In Zope 2.5.1, the same code now returns *all* records. It seems like n=
ow
> suddenly comparing dates and an empty string always returns true.

That is a funky way to pass the value when using range:max. I would just =
pass=20
it bare as in:

query['effective_date'] =3D DateTime()

You only need to pass a sequence as your search term if: You want to matc=
h on=20
multiple values, you are using "range:min:max", or if you are looking for=
 the=20
empty string (which makes me a tad ill whenever I see it, but...). Otherw=
ise,=20
you can just pass the single value.

hth,

-Casey