diff --git a/roundup/cgi/ZTUtils/Batch.py b/roundup/cgi/ZTUtils/Batch.py index 66dde68..c4377d6 100644 --- a/roundup/cgi/ZTUtils/Batch.py +++ b/roundup/cgi/ZTUtils/Batch.py @@ -18,7 +18,7 @@ __version__='$Revision: 1.3 $'[11:-2] class LazyPrevBatch: def __of__(self, parent): - return Batch(parent._sequence, parent._size, + return Batch(parent._sequence, parent.size, parent.first - parent._size + parent.overlap, 0, parent.orphan, parent.overlap) @@ -26,7 +26,7 @@ class LazyNextBatch: def __of__(self, parent): try: parent._sequence[parent.end] except IndexError: return None - return Batch(parent._sequence, parent._size, + return Batch(parent._sequence, parent.size, parent.end - parent.overlap, 0, parent.orphan, parent.overlap) @@ -60,6 +60,11 @@ class Batch: the batch. "sequence_length" is the length of the original, unbatched, sequence + + Note: "_size" is the "actual" size used to perform batch calulcations, + while "size" is the "representative" size. (ie. a "special value" of + "size" used by the templates may translate to a different value for + "_size" which is used internally for batch calculations). ''' start = start + 1 @@ -67,8 +72,8 @@ class Batch: start,end,sz = opt(start,end,size,orphan,sequence) self._sequence = sequence - self.size = sz - self._size = size + self.size = size + self._size = sz self.start = start self.end = end self.orphan = orphan diff --git a/roundup/cgi/templating.py b/roundup/cgi/templating.py index b0eaf02..1b79398 100644 --- a/roundup/cgi/templating.py +++ b/roundup/cgi/templating.py @@ -2831,7 +2831,7 @@ class Batch(ZTUtils.Batch): def previous(self): if self.start == 1: return None - return Batch(self.client, self._sequence, self._size, + return Batch(self.client, self._sequence, self.size, self.first - self._size + self.overlap, 0, self.orphan, self.overlap) @@ -2840,7 +2840,7 @@ class Batch(ZTUtils.Batch): self._sequence[self.end] except IndexError: return None - return Batch(self.client, self._sequence, self._size, + return Batch(self.client, self._sequence, self.size, self.end - self.overlap, 0, self.orphan, self.overlap) class TemplatingUtils: