This is an automated email from the ASF dual-hosted git repository.
kentontaylor 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 fa69002 Preserve exact URL in pagination helper
fa69002 is described below
commit fa69002321283ec70e9da75a1b63d7180dd1fbc6
Author: Dave Brondsema <[email protected]>
AuthorDate: Mon Nov 29 13:04:10 2021 -0500
Preserve exact URL in pagination helper
---
Allura/allura/lib/widgets/form_fields.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Allura/allura/lib/widgets/form_fields.py
b/Allura/allura/lib/widgets/form_fields.py
index d64d3df..3400ac9 100644
--- a/Allura/allura/lib/widgets/form_fields.py
+++ b/Allura/allura/lib/widgets/form_fields.py
@@ -17,6 +17,9 @@
from __future__ import unicode_literals
from __future__ import absolute_import
+
+from urllib.parse import urlparse
+
from tg import tmpl_context as c
from tg import request, url
import json
@@ -314,7 +317,9 @@ class PageList(ew_core.Widget):
def page_url(page):
params = request.GET.copy()
params['page'] = page - page_offset
- return url(request.path, params)
+ # REQUEST_URI keeps double-slashes, but not available in all
environments (like tests)
+ curr_path = urlparse(request.environ.get('REQUEST_URI')).path or
request.path
+ return url(curr_path, params)
return paginate.Page(list(range(count)), page + page_offset,
int(limit),
url_maker=page_url,
)