[Zope-Checkins] SVN: Zope/trunk/src/Products/PluginIndexes/Date Made the actual max value clearer
Hanno Schlichting
hannosch at hannosch.eu
Wed Aug 4 16:00:13 EDT 2010
Log message for revision 115444:
Made the actual max value clearer
Changed:
U Zope/trunk/src/Products/PluginIndexes/DateIndex/DateIndex.py
U Zope/trunk/src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py
-=-
Modified: Zope/trunk/src/Products/PluginIndexes/DateIndex/DateIndex.py
===================================================================
--- Zope/trunk/src/Products/PluginIndexes/DateIndex/DateIndex.py 2010-08-04 19:58:38 UTC (rev 115443)
+++ Zope/trunk/src/Products/PluginIndexes/DateIndex/DateIndex.py 2010-08-04 20:00:12 UTC (rev 115444)
@@ -51,8 +51,9 @@
DSTOFFSET = STDOFFSET
DSTDIFF = DSTOFFSET - STDOFFSET
-MAX32 = 2**31
+MAX32 = 2**31 - 1
+
class LocalTimezone(tzinfo):
def utcoffset(self, dt):
@@ -264,9 +265,7 @@
t_val = ( ( ( ( yr * 12 + mo ) * 31 + dy ) * 24 + hr ) * 60 + mn )
-
-
- if t_val >= MAX32:
+ 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)"
Modified: Zope/trunk/src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py
===================================================================
--- Zope/trunk/src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py 2010-08-04 19:58:38 UTC (rev 115443)
+++ Zope/trunk/src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py 2010-08-04 20:00:12 UTC (rev 115444)
@@ -37,7 +37,7 @@
from Products.PluginIndexes.interfaces import IDateRangeIndex
_dtmldir = os.path.join( package_home( globals() ), 'dtml' )
-MAX32 = 2**31
+MAX32 = 2**31 - 1
class DateRangeIndex(UnIndex):
@@ -398,7 +398,7 @@
elif isinstance(value, DateTime):
value = value.millis() / 1000 / 60 # flatten to minutes
result = int( value )
- if result >= MAX32:
+ 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)
More information about the Zope-Checkins
mailing list