From: Elrond Date: Sat, 21 May 2011 14:38:34 +0000 (+0200) Subject: Give Pagination.get_page_url() a request instead of path and GET X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0e84c707cb57b864fff4bdd438644c4313677893;p=mediagoblin.git Give Pagination.get_page_url() a request instead of path and GET Makes calling Pagination.get_page_url() much simpler. --- 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 @@ {% endif %} diff --git a/mediagoblin/util.py b/mediagoblin/util.py index d37d160e..a1af7bd0 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,11 +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, + Get a new page based of the request, the new page number, and existing get parameters. """ + 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" % (