[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/DateRangeIndex - DateRangeIndex.py:1.6.2.3

Chris McDonough cvs-admin at zope.org
Tue Nov 4 10:01:48 EST 2003


Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/DateRangeIndex
In directory cvs.zope.org:/tmp/cvs-serv29297

Modified Files:
      Tag: Zope-2_7-branch
	DateRangeIndex.py 
Log Message:
remove magic to convert longs to sys.maxint.


=== Zope/lib/python/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py 1.6.2.2 => 1.6.2.3 ===
--- Zope/lib/python/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py:1.6.2.2	Sun Nov  2 06:59:12 2003
+++ Zope/lib/python/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py	Tue Nov  4 10:01:17 2003
@@ -405,16 +405,11 @@
             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 )
+        result = int( value )
+        if isinstance(result, long): # this won't work
+            raise ValueError( '%s is not within the range of dates allowed'
+                              'by a DateRangeIndex' % value)
+        return result
 
 InitializeClass( DateRangeIndex )
 




More information about the Zope-Checkins mailing list