remove dependency on future function

no need six or future if there is only one function.
This commit is contained in:
林檎 2017-03-08 11:48:12 +08:00
parent a752e62963
commit 108302ff9b

View File

@ -50,13 +50,12 @@ from tornado import version as tornadoVersion
try:
from urllib.parse import quote
from imp import reload
from past.builtins import xrange
except ImportError as e:
from urllib import quote
try:
from flask_login import __version__ as flask_loginVersion
except ImportError, e:
except ImportError as e:
from flask_login.__about__ import __version__ as flask_loginVersion
try:
@ -260,6 +259,10 @@ class Pagination(object):
def iter_pages(self, left_edge=2, left_current=2,
right_current=5, right_edge=2):
last = 0
if 'xrange' not in globals():#no xrange in Python3
global xrange
xrange = range
for num in xrange(1, self.pages + 1): # ToDo: can be simplified
if num <= left_edge or (num > self.page - left_current - 1 and num < self.page + right_current) \
or num > self.pages - right_edge: