allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [allura] branch master updated: [#8354] fix pagination regression: preserve url parameters like q for example
Date Fri, 13 Mar 2020 16:14:32 GMT
This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git


The following commit(s) were added to refs/heads/master by this push:
     new 534cebc  [#8354] fix pagination regression: preserve url parameters like q for example
534cebc is described below

commit 534cebc38c67f4a5fc14f698067ef60cf2b89642
Author: Dave Brondsema <dave@brondsema.net>
AuthorDate: Fri Mar 13 12:14:15 2020 -0400

    [#8354] fix pagination regression: preserve url parameters like q for example
---
 Allura/allura/lib/widgets/form_fields.py                |  3 +--
 ForgeTracker/forgetracker/tests/functional/test_root.py | 10 +++++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Allura/allura/lib/widgets/form_fields.py b/Allura/allura/lib/widgets/form_fields.py
index b60cee1..4e69621 100644
--- a/Allura/allura/lib/widgets/form_fields.py
+++ b/Allura/allura/lib/widgets/form_fields.py
@@ -312,8 +312,7 @@ class PageList(ew_core.Widget):
             params['page'] = page - page_offset
             return url(request.path, params)
         return paginate.Page(list(range(count)), page + page_offset, int(limit),
-                             url=page_url,
-                             url_maker=lambda pagenum: '?page={}&limit={}'.format(pagenum-1,
limit)
+                             url_maker=page_url,
                              )
 
     def prepare_context(self, context):
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index a5d9fe8..f1a9673 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -1381,9 +1381,13 @@ class TestFunctionalController(TrackerTestController):
         ThreadLocalORMSession.flush_all()
         M.MonQTask.run_ready()
         ThreadLocalORMSession.flush_all()
-        response = self.app.get('/p/test/bugs/search/?q=test')
-        assert '3 results' in response, response.showbrowser()
-        assert 'test third ticket' in response, response.showbrowser()
+        response = self.app.get('/p/test/bugs/search/?q=test&limit=2')
+        response.mustcontain('results of 3')
+        response.mustcontain('test second ticket')
+        next_page_link = response.html.select('.page_list a')[0]
+        assert_equal(next_page_link.text, '2')
+        # keep 'q' and zero-based page nums:
+        assert_equal(next_page_link['href'], '/p/test/bugs/search/?q=test&limit=2&page=1')
 
         # 'filter' is special kwarg, don't let it cause problems
         r = self.app.get('/p/test/bugs/search/?q=test&filter=blah')


Mime
View raw message