From 040d3553fe9aa19b6ccc7915862888c35792019d Mon Sep 17 00:00:00 2001 From: Iurii Kriachko Date: Wed, 1 May 2013 20:13:27 +0300 Subject: [PATCH] fix IndexError --- pure_pagination/paginator.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pure_pagination/paginator.py b/pure_pagination/paginator.py index 52f62ec..6f86b67 100644 --- a/pure_pagination/paginator.py +++ b/pure_pagination/paginator.py @@ -188,8 +188,9 @@ def pages(self): if (page >= self.number - left_side) and (page <= self.number + right_side): result.append(page) continue - if result[-1]: - result.append(None) + if result: + if result[-1]: + result.append(None) return result