From edee20ff506779b7a7d4e10321a0a619ce0eb03d Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Thu, 14 Jun 2012 23:04:30 +0100 Subject: [PATCH] Reverted part of 169b1a40 which was mistakenly applied to a non-iterator class. Doing next(IfParser()) works for Python 2.7, because it calls IfParser.next(), but in Python 3 will call IfParser.__next__() which does not work since it is not an iterator and does not have that method. --- django/template/smartif.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/django/template/smartif.py b/django/template/smartif.py index 272eab1e91..54d74b4e25 100644 --- a/django/template/smartif.py +++ b/django/template/smartif.py @@ -165,7 +165,7 @@ class IfParser(object): self.tokens = mapped_tokens self.pos = 0 - self.current_token = next(self) + self.current_token = self.next() def translate_token(self, token): try: @@ -193,11 +193,11 @@ class IfParser(object): def expression(self, rbp=0): t = self.current_token - self.current_token = next(self) + self.current_token = self.next() left = t.nud(self) while rbp < self.current_token.lbp: t = self.current_token - self.current_token = next(self) + self.current_token = self.next() left = t.led(left, self) return left