Skip to content

Commit d00579c

Browse files
committed
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.
1 parent 3fcb45f commit d00579c

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

CHANGES.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@ Fixed:
118118
on postgres. Added a check in rdbms_common layer that max nodeid
119119
is < 2^31 -1. Large nodeid now return no such id error upstream.
120120
Patch idea from: martin.v.loewis. (John Rouillard)
121-
121+
- issue2550723 Fix propagation of @pagesize
122+
When @pagesize=0 is specified (indicating show all), the value of
123+
pagesize is not propigated to the prev link. This patch fixes that.
124+
Patch provided by John Kristensen. (Applied, light testing by John
125+
Rouillard.)
122126

123127
2016-01-11: 1.5.1
124128

roundup/cgi/ZTUtils/Batch.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717

1818
class LazyPrevBatch:
1919
def __of__(self, parent):
20-
return Batch(parent._sequence, parent._size,
20+
return Batch(parent._sequence, parent.size,
2121
parent.first - parent._size + parent.overlap, 0,
2222
parent.orphan, parent.overlap)
2323

2424
class LazyNextBatch:
2525
def __of__(self, parent):
2626
try: parent._sequence[parent.end]
2727
except IndexError: return None
28-
return Batch(parent._sequence, parent._size,
28+
return Batch(parent._sequence, parent.size,
2929
parent.end - parent.overlap, 0,
3030
parent.orphan, parent.overlap)
3131

@@ -60,15 +60,20 @@ def __init__(self, sequence, size, start=0, end=0,
6060
the batch.
6161
6262
"sequence_length" is the length of the original, unbatched, sequence
63+
64+
Note: "_size" is the "actual" size used to perform batch calulcations,
65+
while "size" is the "representative" size. (ie. a "special value" of
66+
"size" used by the templates may translate to a different value for
67+
"_size" which is used internally for batch calculations).
6368
'''
6469

6570
start = start + 1
6671

6772
start,end,sz = opt(start,end,size,orphan,sequence)
6873

6974
self._sequence = sequence
70-
self.size = sz
71-
self._size = size
75+
self.size = size
76+
self._size = sz
7277
self.start = start
7378
self.end = end
7479
self.orphan = orphan

roundup/cgi/templating.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2925,7 +2925,7 @@ def propchanged(self, *properties):
29252925
def previous(self):
29262926
if self.start == 1:
29272927
return None
2928-
return Batch(self.client, self._sequence, self._size,
2928+
return Batch(self.client, self._sequence, self.size,
29292929
self.first - self._size + self.overlap, 0, self.orphan,
29302930
self.overlap)
29312931

@@ -2934,7 +2934,7 @@ def next(self):
29342934
self._sequence[self.end]
29352935
except IndexError:
29362936
return None
2937-
return Batch(self.client, self._sequence, self._size,
2937+
return Batch(self.client, self._sequence, self.size,
29382938
self.end - self.overlap, 0, self.orphan, self.overlap)
29392939

29402940
class TemplatingUtils:

0 commit comments

Comments
 (0)