X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/52b732386eaabbe2d99e3b13ad680ab06bdc4c47..9b8694523acd70fc901b4092c874548e5faf211f:/forum/utils/pagination.py diff --git a/forum/utils/pagination.py b/forum/utils/pagination.py index fb99244..2b71dbd 100644 --- a/forum/utils/pagination.py +++ b/forum/utils/pagination.py @@ -3,6 +3,7 @@ from django.utils.datastructures import SortedDict from django import template from django.core.paginator import Paginator, EmptyPage from django.utils.translation import ugettext as _ +from django.utils.html import escape from django.http import Http404 from django.utils.http import urlquote from django.utils.safestring import mark_safe @@ -15,7 +16,7 @@ def generate_uri(querydict, exclude=None): for k, l in querydict.iterlists(): if (not exclude) or (not k in exclude): - all += ["%s=%s" % (k, urlquote(strip_tags(v))) for v in l] + all += ["%s=%s" % (k, escape(strip_tags(v))) for v in l] return "&".join(all) @@ -210,8 +211,8 @@ def _paginated(request, objects, context): def get_page(): object_list = page_obj.object_list - if hasattr(object_list, 'lazy'): - return object_list.lazy() + #if hasattr(object_list, 'lazy'): + # return object_list.lazy() return object_list paginator.page = get_page() @@ -240,9 +241,9 @@ def _paginated(request, objects, context): page_numbers = [] if sort: - url_builder = lambda n: mark_safe("%s%s%s=%s&%s=%s" % (base_path, url_joiner, context.SORT, sort, context.PAGE, n)) + url_builder = lambda n: mark_safe("%s%s%s=%s&%s=%s" % (escape(base_path), url_joiner, context.SORT, sort, context.PAGE, n)) else: - url_builder = lambda n: mark_safe("%s%s%s=%s" % (base_path, url_joiner, context.PAGE, n)) + url_builder = lambda n: mark_safe("%s%s%s=%s" % (escape(base_path), url_joiner, context.PAGE, n)) if range_start > (context.outside_page_range + 1): page_numbers.append([(n, url_builder(n)) for n in range(1, context.outside_page_range + 1)])