From 72cb5ead45ee4748c98750804773f2724de0eb9c Mon Sep 17 00:00:00 2001 From: Tim Fletcher Date: Wed, 29 Jul 2015 14:00:42 -0600 Subject: [PATCH] xrange compatibility for Python 3.x --- pure_pagination/paginator.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pure_pagination/paginator.py b/pure_pagination/paginator.py index 52f62ec..df9ee39 100644 --- a/pure_pagination/paginator.py +++ b/pure_pagination/paginator.py @@ -10,6 +10,12 @@ PAGE_RANGE_DISPLAYED = PAGINATION_SETTINGS.get("PAGE_RANGE_DISPLAYED", 10) MARGIN_PAGES_DISPLAYED = PAGINATION_SETTINGS.get("MARGIN_PAGES_DISPLAYED", 2) +# range in Python 3.x is xrange from Python 2.x +try: + xrange +except NameError: + xrange = range + class InvalidPage(Exception): pass