[Zope] Magic behavior of DateIndex in a ZCatalog

Nico Grubert nicogrubert@web.de
Thu, 5 Jun 2003 13:40:27 +0200


Hi there,

I am developing a Zope Product in Python where I store my content objects in the ZODB. Furthermore, they are cataloged in a ZCatalog. The content objects have an attribute "creationdate" so I decided to add a DateIndex and a metadata column, both named "creationdate" in the ZCatalog.

When I create a content object I was confused about the values the ZCatalog stores for the Index and for the metatype because the values differ from each other.

I tried to pass different TimeStamps when a create a content object. 
Here is what I found out:

Python TimeStamp : time.asctime() 
DateIndex value : 1073242818
Metadata value : Thu Jun 05 12:18:58 2003

Python TimeStamp : time.gmtime() 
DateIndex value : '' 
Metadata value : (2003, 6, 5, 10, 20, 6, 3, 156, 0) 

Python TimeStamp : time.localtime() 
DateIndex value : '' 
Metadata value : (2003, 6, 5, 12, 11, 13, 3, 156, 1) 

Python TimeStamp : time.time()
DateIndex value : 1073242687 
Metadata value : 1054807644.02

Python TimeStamp : DateTime.DateTime()
DateIndex value : 1073242822 
Metadata value : 2003/06/05 12:22:36.673 GMT+2



This shows the different values stored for the DateIndex and the Metadata column in the ZCatalog.
I thought, these magic "1073242..." values stored for the DateIndex "creationdate" have something to do with the float value since the epoch (1970/01/01) which can be returned by time.time().

But the value of the DateIndex (1073242687) differs so much from the value of the metadata (1054807644.02). When I used time.time() one time it stored "1054807644.02" for the DateIndex, but this happened only once !

So, here are my questions:
- Why does the DateIndex value differs so much from the metadata value ?
- How can I search for content objects that are created at 2003/06/05 for instance ?
- Which TimeStamp should I use when I create a content object ?


My configuration:
(Zope 2.6.0 (binary release, python 2.1, win32-x86), python 2.1.3, win32) 


Thank you in advance.

regards,
nico
____________________________________________________________________________
Jetzt bei WEB.DE FreeMail anmelden = 1qm Regenwald schuetzen! Helfen
Sie mit! Nutzen Sie den Serien-Testsieger. http://user.web.de/Regenwald