changeset 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 2b551b6b0830
children b5afae9022cf
files CHANGES.txt roundup/cgi/ZTUtils/Batch.py roundup/cgi/templating.py
diffstat 3 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Sat Jun 18 22:48:21 2016 -0400
+++ b/CHANGES.txt	Sat Jun 18 23:49:41 2016 -0400
@@ -118,7 +118,11 @@
   on postgres. Added a check in rdbms_common layer that max nodeid
   is < 2^31 -1. Large nodeid now return no such id error upstream.
   Patch idea from: martin.v.loewis. (John Rouillard)
-
+- issue2550723 Fix propagation of @pagesize
+  When @pagesize=0 is specified (indicating show all), the value of
+  pagesize is not propigated to the prev link. This patch fixes that.
+  Patch provided by John Kristensen. (Applied, light testing by John
+  Rouillard.)
 
 2016-01-11: 1.5.1
 
--- 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
--- a/roundup/cgi/templating.py	Sat Jun 18 22:48:21 2016 -0400
+++ b/roundup/cgi/templating.py	Sat Jun 18 23:49:41 2016 -0400
@@ -2925,7 +2925,7 @@
     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)
 
@@ -2934,7 +2934,7 @@
             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:

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