jamespacileo/django-pure-pagination

Special characters in GET parameters break string interpolation

Pankrat opened this issue · 1 comments

If one of the GET parameters includes an escaped character (e.g. &) and one passes request into the paginator, _other_page_querystring will break because it's unable to interpolate the page number into the query string:

'query=Spam+%26+Eggs&page=%s' % 1

File "search/views.py", line 25, in search
          results = paginator.page(page)
File "pure_pagination/paginator.py", line 53, in page
          return Page(self.object_list[bottom:top], number, self)
File "pure_pagination/paginator.py", line 126, in __init__
          self.number = PageRepresentation(number, self._other_page_querystring(number))
File "pure_pagination/paginator.py", line 217, in _other_page_querystring
          return self.base_queryset %page_number
ValueError: unsupported format character '+' (0x2b) at index 14

Just realized I was still using version 0.1. The issue is already fixed in 0.2. Sorry for the noise.