[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/DateIndex - DateIndex.py:1.6

Shane Hathaway shane@cvs.zope.org
Tue, 30 Jul 2002 12:25:46 -0400


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

Modified Files:
	DateIndex.py 
Log Message:
Made integer overflows in DateIndex easier to deal with.


=== Zope/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py 1.5 => 1.6 ===
 
         t_val = ( ( ( ( yr * 12 + mo ) * 31 + dy ) * 24 + hr ) * 60 + mn )
 
-        return t_val
+        try:
+            # t_val must be IntType, not LongType
+            return int(t_val)
+        except OverflowError:
+            raise OverflowError, (
+                "%s is not within the range of indexable dates (index: %s)"
+                % (value, self.id))
 
 
 manage_addDateIndexForm = DTMLFile( 'dtml/addDateIndex', globals() )