allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [allura] 04/14: [#8354] webhelpers.paginate -> standalone paginate package
Date Tue, 10 Mar 2020 16:11:56 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 61a80cafa4b9b3339cbf1b3a014d2a429db1be2e
Author: Dave Brondsema <dave@brondsema.net>
AuthorDate: Fri Mar 6 15:31:43 2020 -0500

    [#8354] webhelpers.paginate -> standalone paginate package
---
 Allura/allura/controllers/site_admin.py                   | 2 +-
 Allura/allura/lib/widgets/form_fields.py                  | 6 ++++--
 Allura/allura/templates/widgets/page_list.html            | 2 +-
 ForgeBlog/forgeblog/templates/blog_widgets/page_list.html | 4 ++--
 requirements.in                                           | 1 +
 requirements.txt                                          | 1 +
 6 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/Allura/allura/controllers/site_admin.py b/Allura/allura/controllers/site_admin.py
index 14b5ffd..644c9c9 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -33,6 +33,7 @@ from tg import request
 from formencode import validators, Invalid
 from webob.exc import HTTPNotFound, HTTPFound
 from ming.odm import ThreadLocalORMSession
+import paginate
 
 from allura.app import SitemapEntry
 from allura.lib import helpers as h
@@ -50,7 +51,6 @@ from allura.scripts.delete_projects import DeleteProjects
 import allura
 
 from six.moves.urllib.parse import urlparse
-from webhelpers import paginate
 import six
 from six.moves import range
 from six.moves import map
diff --git a/Allura/allura/lib/widgets/form_fields.py b/Allura/allura/lib/widgets/form_fields.py
index 7610325..b60cee1 100644
--- a/Allura/allura/lib/widgets/form_fields.py
+++ b/Allura/allura/lib/widgets/form_fields.py
@@ -23,7 +23,7 @@ import json
 import logging
 
 from formencode import validators as fev
-from webhelpers import paginate
+import paginate
 
 import ew as ew_core
 import ew.jinja2_ew as ew
@@ -312,7 +312,9 @@ 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=page_url,
+                             url_maker=lambda pagenum: '?page={}&limit={}'.format(pagenum-1,
limit)
+                             )
 
     def prepare_context(self, context):
         context = super(PageList, self).prepare_context(context)
diff --git a/Allura/allura/templates/widgets/page_list.html b/Allura/allura/templates/widgets/page_list.html
index 2621601..fbe25a2 100644
--- a/Allura/allura/templates/widgets/page_list.html
+++ b/Allura/allura/templates/widgets/page_list.html
@@ -23,7 +23,7 @@
 {% if pager_output.strip() %}
 <div>
     <div class="page_list">
-      {{ pager_output }}
+      {{ pager_output|safe }}
     </div>
     <div class="clear"></div>
 </div>
diff --git a/ForgeBlog/forgeblog/templates/blog_widgets/page_list.html b/ForgeBlog/forgeblog/templates/blog_widgets/page_list.html
index bbc9725..0681277 100644
--- a/ForgeBlog/forgeblog/templates/blog_widgets/page_list.html
+++ b/ForgeBlog/forgeblog/templates/blog_widgets/page_list.html
@@ -19,10 +19,10 @@
 <div style="margin: 10px">
   {% set paginator = widget.paginator(count, page, limit) %}
   <div style="float: right">
-    {{paginator.pager('$link_previous', symbol_previous='Newer Entries >>')}}
+    {{paginator.pager('$link_previous', symbol_previous='Newer Entries >>')|safe}}
   </div>
   <div style="float: left">
-    {{paginator.pager('$link_next', symbol_next='<< Older Entries')}}
+    {{paginator.pager('$link_next', symbol_next='<< Older Entries')|safe}}
   </div>
   <div style="clear: both"></div>
 </div>
diff --git a/requirements.in b/requirements.in
index fdb3fd4..98e4dc7 100644
--- a/requirements.in
+++ b/requirements.in
@@ -21,6 +21,7 @@ MarkupSafe
 Ming==0.5.6
 # oauth2 doesn't have py3.6 support.  There's a fork with fixes but no pypi releases I can
find.  https://github.com/joestump/python-oauth2/issues/223
 oauth2
+paginate
 Paste
 PasteDeploy
 PasteScript
diff --git a/requirements.txt b/requirements.txt
index 04c5a8e..04f722d 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -51,6 +51,7 @@ mock==3.0.5
 nose==1.3.7
 oauth2==1.9.0.post1
 oauthlib==3.0.2           # via requests-oauthlib
+paginate==0.5.6
 paste==3.1.0
 pastedeploy==2.0.1
 pastescript==3.1.0


Mime
View raw message