[Checkins] SVN: z3c.batching/trunk/src/z3c/batching/ Correctly
handle empty lists.
Stephan Richter
srichter at cosmos.phy.tufts.edu
Mon Feb 12 14:39:48 EST 2007
Log message for revision 72503:
Correctly handle empty lists.
Changed:
U z3c.batching/trunk/src/z3c/batching/batch.py
U z3c.batching/trunk/src/z3c/batching/interfaces.py
-=-
Modified: z3c.batching/trunk/src/z3c/batching/batch.py
===================================================================
--- z3c.batching/trunk/src/z3c/batching/batch.py 2007-02-12 15:14:10 UTC (rev 72502)
+++ z3c.batching/trunk/src/z3c/batching/batch.py 2007-02-12 19:39:47 UTC (rev 72503)
@@ -43,7 +43,10 @@
if start + size >= len(list):
self._trueSize = len(list) - start
# See interfaces.IBatch
- self.end = start + self._trueSize - 1
+ if len(list) == 0:
+ self.end = -1
+ else:
+ self.end = start + self._trueSize - 1
@property
def number(self):
Modified: z3c.batching/trunk/src/z3c/batching/interfaces.py
===================================================================
--- z3c.batching/trunk/src/z3c/batching/interfaces.py 2007-02-12 15:14:10 UTC (rev 72502)
+++ z3c.batching/trunk/src/z3c/batching/interfaces.py 2007-02-12 19:39:47 UTC (rev 72503)
@@ -45,7 +45,7 @@
end = zope.schema.Int(
title=u'End Index',
description=u'The index of the sequence at which the batch ends.',
- min=0,
+ min=-1,
default=0,
readonly=True,
required=True)
More information about the Checkins
mailing list