[Zope] Searching date ranges on catalogs.

Lennart Regebro lennart@regebro.nu
Tue, 15 Jan 2002 22:12:24 +0100


From: "Josef Meile" <josef.meile@imes.mavt.ethz.ch>
>I just wondering if you can do it with ZCatalogs.
>I have a product wich I called reserve and it has two fields: startDate and
endDate (both field Indexes). The entry of my >python script is a date
(let's say currentDate). I just need to do search the objects wich satisfy
the following condition:
>startDate<=currentDate<=endDate.

Yes, this can be done, like so:

            query['startDate'] = [currentDate]
            query['startDate_usage'] = 'range:max'
            query['endDate'] = currentDate
            query['endDate_usage'] = 'range:min'
            result = Catalog.searchResults(query)