[Zope-Checkins]
CVS: Zope/lib/python/Products/PluginIndexes/DateRangeIndex
- DateRangeIndex.py:1.8
Chris McDonough
cvs-admin at zope.org
Sun Nov 2 06:57:59 EST 2003
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/DateRangeIndex
In directory cvs.zope.org:/tmp/cvs-serv29531
Modified Files:
DateRangeIndex.py
Log Message:
DateRangeIndexes blew up when attempting to store a date far in the future ( > Y2038 ). This is a workaround. The real fix would be to come up with a different conversion algorithm or to use OOBTrees to store datum.
=== Zope/lib/python/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py 1.7 => 1.8 ===
--- Zope/lib/python/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py:1.7 Tue Sep 9 15:48:24 2003
+++ Zope/lib/python/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py Sun Nov 2 06:57:58 2003
@@ -15,6 +15,7 @@
"""
import os
+import sys
from Products.PluginIndexes import PluggableIndex
from Products.PluginIndexes.common.UnIndex import UnIndex
@@ -404,6 +405,15 @@
value = dt_obj.millis() / 1000 / 60 # flatten to minutes
if isinstance( value, DateTime ):
value = value.millis() / 1000 / 60 # flatten to minutes
+ # XXX 2038K bug:
+ # we might still be dealing with a long.
+ # we're using IOBTrees with dates as keys and we
+ # cant convert long to int if its > sys.maxint.
+ # BTrees code blows up if we try to ask it for a long key,
+ # so we punt here. In a future version, we should either
+ # come up with a LOBTree or use OOBTrees to store datum.
+ if value > sys.maxint:
+ value = sys.maxint
return int( value )
InitializeClass( DateRangeIndex )
More information about the Zope-Checkins
mailing list