From 536ed06a50f397c6c98e3779a8d40eb433ed017c Mon Sep 17 00:00:00 2001 From: ber Date: Sat, 3 Sep 2011 20:12:51 +0000 Subject: [PATCH] issue2550678: Allow pagesize=-1 which returns all results. Suggested and implemented by John Kristensen. Tested by Satchidanand Haridas. git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4645 57a73879-2fb5-44c3-a270-3262357dd7e2 --- CHANGES.txt | 5 +++++ roundup/cgi/ZTUtils/Batch.py | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 2aac40e..ac6e445 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -6,6 +6,11 @@ Entries without name were done by Richard Jones. 2011-XX-XX 1.4.20 (r4XXX) Features: + +- issue2550678: Allow pagesize=-1 which returns all results. + Suggested and implemented by John Kristensen. + Tested by Satchidanand Haridas. (Bernhard) + Fixed: - issue2550715: IndexError when requesting non-existing file via http. diff --git a/roundup/cgi/ZTUtils/Batch.py b/roundup/cgi/ZTUtils/Batch.py index 66dde68..0ee9738 100644 --- a/roundup/cgi/ZTUtils/Batch.py +++ b/roundup/cgi/ZTUtils/Batch.py @@ -52,7 +52,8 @@ class Batch: "orphan" elements, it is combined with the current batch. "overlap" is the number of elements shared by adjacent batches. If "size" is not specified, it is computed from - "start" and "end". Failing that, it is 7. + "start" and "end". If "size" is 0, it is the length of + the sequence. Failing that, it is 7. Attributes: Note that the "start" attribute, unlike the argument, is a 1-based index (I know, lame). "first" is the @@ -92,7 +93,9 @@ class Batch: def opt(start,end,size,orphan,sequence): if size < 1: - if start > 0 and end > 0 and end >= start: + if size == 0: + size=len(sequence) + elif start > 0 and end > 0 and end >= start: size=end+1-start else: size=7 -- 2.30.2