Log message for revision 115442: Adjusted overflow logic in DateIndex and DateRangeIndex to work with latest ZODB 3.10.0b4. Instead of an OverflowError a TypeError is raised now.
Changed: U Zope/trunk/doc/CHANGES.rst U Zope/trunk/src/Products/PluginIndexes/DateIndex/DateIndex.py U Zope/trunk/src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py -=- Modified: Zope/trunk/doc/CHANGES.rst =================================================================== --- Zope/trunk/doc/CHANGES.rst 2010-08-04 18:35:50 UTC (rev 115441) +++ Zope/trunk/doc/CHANGES.rst 2010-08-04 19:14:19 UTC (rev 115442) @@ -11,6 +11,9 @@ Bugs Fixed ++++++++++ +- Adjusted overflow logic in DateIndex and DateRangeIndex to work with latest + ZODB 3.10.0b4. + - Made sure to exclude a number of meta ZCML handlers from ``zope.*`` packages where Zope2 provides its own implementations. Modified: Zope/trunk/src/Products/PluginIndexes/DateIndex/DateIndex.py =================================================================== --- Zope/trunk/src/Products/PluginIndexes/DateIndex/DateIndex.py 2010-08-04 18:35:50 UTC (rev 115441) +++ Zope/trunk/src/Products/PluginIndexes/DateIndex/DateIndex.py 2010-08-04 19:14:19 UTC (rev 115442) @@ -51,6 +51,7 @@ DSTOFFSET = STDOFFSET DSTDIFF = DSTOFFSET - STDOFFSET +MAX32 = 2**31 class LocalTimezone(tzinfo): @@ -263,9 +264,11 @@ t_val = ( ( ( ( yr * 12 + mo ) * 31 + dy ) * 24 + hr ) * 60 + mn ) - if isinstance(t_val, long): - # t_val must be IntType, not LongType - raise OverflowError, ( + + + if t_val >= MAX32: + # t_val must be integer fitting in the 32bit range + raise OverflowError( "%s is not within the range of indexable dates (index: %s)" % (value, self.id)) Modified: Zope/trunk/src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py =================================================================== --- Zope/trunk/src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py 2010-08-04 18:35:50 UTC (rev 115441) +++ Zope/trunk/src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py 2010-08-04 19:14:19 UTC (rev 115442) @@ -37,6 +37,7 @@ from Products.PluginIndexes.interfaces import IDateRangeIndex _dtmldir = os.path.join( package_home( globals() ), 'dtml' ) +MAX32 = 2**31 class DateRangeIndex(UnIndex): @@ -397,7 +398,8 @@ elif isinstance(value, DateTime): value = value.millis() / 1000 / 60 # flatten to minutes result = int( value ) - if isinstance(result, long): # this won't work (Python 2.3) + if result >= MAX32: + # t_val must be integer fitting in the 32bit range raise OverflowError( '%s is not within the range of dates allowed' 'by a DateRangeIndex' % value) return result _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org https://mail.zope.org/mailman/listinfo/zope-checkins