diff options
-rw-r--r-- | mediagoblin/templates/mediagoblin/utils/pagination.html | 9 | ||||
-rw-r--r-- | mediagoblin/util.py | 10 |
2 files changed, 7 insertions, 12 deletions
diff --git a/mediagoblin/templates/mediagoblin/utils/pagination.html b/mediagoblin/templates/mediagoblin/utils/pagination.html index b74cbfcf..5ca5e09b 100644 --- a/mediagoblin/templates/mediagoblin/utils/pagination.html +++ b/mediagoblin/templates/mediagoblin/utils/pagination.html @@ -21,15 +21,13 @@ <div class=pagination> {% if pagination.has_prev %} - <a href={{ pagination.get_page_url(request.path_info, - pagination.page-1, request.GET) }}>« Prev</> + <a href={{ pagination.get_page_url(request, pagination.page-1) }}>« Prev</> {% endif %} {%- for page in pagination.iter_pages() %} {% if page %} {% if page != pagination.page %} - <a href={{ pagination.get_page_url(request.path_info, - page, request.GET) }}>{{ page }}</a> + <a href={{ pagination.get_page_url(request, page) }}>{{ page }}</a> {% else %} <strong>{{ page }}</strong> {% endif %} @@ -39,8 +37,7 @@ {%- endfor %} {% if pagination.has_next %} - <a href={{ pagination.get_page_url(request.path_info, - pagination.page+1, request.GET) }}>Next »</a> + <a href={{ pagination.get_page_url(request, pagination.page+1) }}>Next »</a> {% endif %} </div> {% endif %} diff --git a/mediagoblin/util.py b/mediagoblin/util.py index d37d160e..f56bea43 100644 --- a/mediagoblin/util.py +++ b/mediagoblin/util.py @@ -29,8 +29,6 @@ from mediagoblin import globals as mgoblin_globals import urllib from math import ceil import copy -import decorators -from webob import exc TESTS_ENABLED = False def _activate_testing(): @@ -353,13 +351,13 @@ class Pagination(object): yield num last = num - def get_page_url(self, path_info, page_no, get_params=None): + def get_page_url(self, request, page_no): """ - Get a new page based of the path_info, the new page number, - and existing get parameters. + Get a new page url based of the request, and the new page number. """ + path_info = request.path_info + get_params = request.GET new_get_params = copy.copy(get_params or {}) new_get_params['page'] = page_no return "%s?%s" % ( path_info, urllib.urlencode(new_get_params)) - |