Skip to content

Commit

Permalink
Merge pull request #4 from miratcan/master
Browse files Browse the repository at this point in the history
Some PEP8 fixes have been done.
  • Loading branch information
bilbeyt authored May 20, 2020
2 parents 3335c59 + 7501460 commit 1afba55
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions fast_pagination/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class FastPaginator(Paginator):

def __init__(self, object_list, per_page, orphans=0,
allow_empty_first_page=True):
super().__init__(object_list, per_page, orphans, allow_empty_first_page)
super().__init__(object_list, per_page, orphans,
allow_empty_first_page)
self.cache_key = self.get_paginator_cache_key()
self.timeout = getattr(settings, "FAST_PAGINATION_TIMEOUT", 3600)
if isinstance(object_list, QuerySet):
Expand All @@ -27,8 +28,8 @@ def count(self):
if result is None:
c = getattr(self.object_list, 'count', None)
if callable(c) and not inspect.isbuiltin(c) \
and method_has_no_args(c) \
and isinstance(self.object_list, QuerySet):
and method_has_no_args(c) \
and isinstance(self.object_list, QuerySet):
result = c()
else:
result = len(self.object_list)
Expand Down
4 changes: 2 additions & 2 deletions fast_pagination/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ def test_invalid_page(self):

def test_page_not_an_integer(self):
example_list = ['1', '2', '3']
with self.assertRaises(InvalidPage):
with self.assertRaises(PageNotAnInteger):
paginator = FastPaginator(example_list, 2)
paginator.page(1.5)
paginator.page(None)

def test_page_empty(self):
example_list = []
Expand Down

0 comments on commit 1afba55

Please sign in to comment.