diff roundup/cgi/ZTUtils/Batch.py @ 5087:39af8a0f3446

Applied patch attached to issue2550723. Problem in index page @pagesize=0 not properly propigated to previous batch link (is set to actual number of entries displayed). Using demo.py verified original issue with 0 page size. Also verified that a non-zero page size was properly propigated (values 5 and 20). Applied patch attached to issue. Verified issue with size 0 fixed. Verified that values 5 and 20 worked correctly. Updated CHANGES.txt.
author John Rouillard <rouilj@ieee.org>
date Sat, 18 Jun 2016 23:49:41 -0400
parents 6e3e4f24c753
children 35ea9b1efc14
line wrap: on
line diff
--- a/roundup/cgi/ZTUtils/Batch.py	Sat Jun 18 22:48:21 2016 -0400
+++ b/roundup/cgi/ZTUtils/Batch.py	Sat Jun 18 23:49:41 2016 -0400
@@ -17,7 +17,7 @@
 
 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)
 
@@ -25,7 +25,7 @@
     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 @@
         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 @@
         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

Roundup Issue Tracker: http://roundup-tracker.org/