Commit 9152ce44 authored by Hanno Schlichting's avatar Hanno Schlichting

Made the actual max value clearer

parent a5a09083
......@@ -51,7 +51,8 @@ else:
DSTOFFSET = STDOFFSET
DSTDIFF = DSTOFFSET - STDOFFSET
MAX32 = 2**31
MAX32 = 2**31 - 1
class LocalTimezone(tzinfo):
......@@ -264,9 +265,7 @@ class DateIndex(UnIndex, PropertyManager):
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)"
......
......@@ -37,7 +37,7 @@ from Products.PluginIndexes.common.util import parseIndexRequest
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 @@ class DateRangeIndex(UnIndex):
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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment