From d9ab8f5799196531542c2f96631a669b44643ced Mon Sep 17 00:00:00 2001 From: homm Date: Tue, 23 Jun 2015 16:32:06 +0300 Subject: [PATCH] do not use local page_size var --- rest_framework/pagination.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rest_framework/pagination.py b/rest_framework/pagination.py index 592786eea..586e7298d 100644 --- a/rest_framework/pagination.py +++ b/rest_framework/pagination.py @@ -499,8 +499,8 @@ class CursorPagination(BasePageSizePagination): template = 'rest_framework/pagination/previous_and_next.html' def paginate_queryset(self, queryset, request, view=None): - self.page_size = page_size = self.get_page_size(request) - if not page_size: + self.page_size = self.get_page_size(request) + if self.page_size is None: return None self.base_url = request.build_absolute_uri() @@ -535,8 +535,8 @@ class CursorPagination(BasePageSizePagination): # If we have an offset cursor then offset the entire page by that amount. # We also always fetch an extra item in order to determine if there is a # page following on from this one. - results = list(queryset[offset:offset + page_size + 1]) - self.page = list(results[:page_size]) + results = list(queryset[offset:offset + self.page_size + 1]) + self.page = list(results[:self.page_size]) # Determine the position of the final item following the page. if len(results) > len(self.page):