Opened 7 years ago
Last modified 16 months ago
#12969 new defect
query paging problem when num_items <= max and page > 1
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | next-stable-1.6.x |
Component: | query system | Version: | |
Severity: | minor | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description (last modified by )
Suppose a query generates 20 results. max=20 is specified in the query string. When page=n (n>1) is also specified, the query will always return the 20 results rather than "beyond the number of pages" Error.
It's ok with web UI, so not sure this is a bug or feature. But it does bring trouble to other components which rely on query system, such as XMLRPC plugin. Suppose you query through xmlrpc with max=20&page=1 and 20 results returned, then query with max=20&page=2 but another 20 results returned, which is not quite reasonable.
How to reproduce: Visit here: https://trac.edgewall.org/query?summary=~query+paging+problem&page=100&max=1
Related code:
if self.num_items <= self.max: self.has_more_pages = False if self.has_more_pages: max = self.max if self.group: max += 1 sql += " LIMIT %d OFFSET %d" % (max, self.offset) if (self.page > int(ceil(float(self.num_items) / self.max)) and self.num_items != 0): #this should not depend of has_more_pages condition raise TracError(_("Page %(page)s is beyond the number of " "pages in the query", page=self.page))
Attachments (0)
Change History (4)
comment:1 by , 7 years ago
Description: | modified (diff) |
---|
comment:2 by , 7 years ago
Milestone: | → next-stable-1.2.x |
---|---|
Severity: | normal → minor |
comment:3 by , 5 years ago
Milestone: | next-stable-1.2.x → next-stable-1.4.x |
---|
When number of the query result is less than number of
max
parameter are same, thepage
parameter is ignored.TracError
should be raisedTracError
should be raisedTracError
should be raised