Ticket #13689: 13689.diff

File 13689.diff, 1.4 KB (added by claudep, 4 years ago)

Attaching Eric's patch as of comment #2

  • django/core/paginator.py

    diff --git a/django/core/paginator.py b/django/core/paginator.py
    index 495cdf2..27051e9 100644
    a b class EmptyPage(InvalidPage): 
    1212class Paginator(object):
    1313    def __init__(self, object_list, per_page, orphans=0, allow_empty_first_page=True):
    1414        self.object_list = object_list
    15         self.per_page = per_page
    16         self.orphans = orphans
     15        self.per_page = int(per_page)
     16        self.orphans = int(orphans)
    1717        self.allow_empty_first_page = allow_empty_first_page
    1818        self._num_pages = self._count = None
    1919
  • tests/regressiontests/pagination_regress/tests.py

    diff --git a/tests/regressiontests/pagination_regress/tests.py b/tests/regressiontests/pagination_regress/tests.py
    index 28fe316..dd6210e 100644
    a b class PaginatorTests(TestCase): 
    8585            (([1, 2], 1, 1, True), (2, 1, [1])),
    8686            (([1, 2, 3], 2, 1, True), (3, 1, [1])),
    8787            ((eleven, 10, 1, True), (11, 1, [1])),
     88            # Non-integer inputs
     89            ((ten, '4', 1, False), (10, 3, [1, 2, 3])),
     90            ((ten, u'4', 1, False), (10, 3, [1, 2, 3])),
     91            ((ten, 4, '1', False), (10, 3, [1, 2, 3])),
     92            ((ten, 4, u'1', False), (10, 3, [1, 2, 3])),
    8893        )
    8994        for params, output in tests:
    9095            self.check_paginator(params, output)
Back to Top