Skip to content
This repository has been archived by the owner on Jun 5, 2018. It is now read-only.

Commit

Permalink
Merge pull request #21 from hsoft/py3
Browse files Browse the repository at this point in the history
Support Python 3.3
  • Loading branch information
zyga committed Jan 14, 2014
2 parents 9c0dadb + 0b4a8b2 commit 2d4f395
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 7 additions & 7 deletions linaro_django_pagination/templatetags/pagination_tags.py
Expand Up @@ -60,7 +60,7 @@ def do_autopaginate(parser, token):
# Check whether there are any other autopaginations are later in this template
expr = lambda obj: (obj.token_type == TOKEN_BLOCK and \
len(obj.split_contents()) > 0 and obj.split_contents()[0] == "autopaginate")
multiple_paginations = len(filter(expr, parser.tokens)) > 0
multiple_paginations = len([tok for tok in parser.tokens if expr(tok)]) > 0

i = iter(token.split_contents())
paginate_by = None
Expand All @@ -69,26 +69,26 @@ def do_autopaginate(parser, token):
orphans = None
word = None
try:
word = i.next()
word = next(i)
assert word == "autopaginate"
queryset_var = i.next()
word = i.next()
queryset_var = next(i)
word = next(i)
if word != "as":
paginate_by = word
try:
paginate_by = int(paginate_by)
except ValueError:
pass
word = i.next()
word = next(i)
if word != "as":
orphans = word
try:
orphans = int(orphans)
except ValueError:
pass
word = i.next()
word = next(i)
assert word == "as"
context_var = i.next()
context_var = next(i)
except StopIteration:
pass
if queryset_var is None:
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Expand Up @@ -54,6 +54,8 @@
"Operating System :: OS Independent",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
],
install_requires=[
'django >= 1.2',
Expand Down

0 comments on commit 2d4f395

Please sign in to comment.