You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The jinja2.utils.Cycler object no longer has a next() method in Python 3:
Running the following with Python 3:
fromjinja2importEnvironmentenv=Environment()
t=env.from_string('''{% set a = cycler('odd', 'even') %}{{ a.next() }}{{ a.next() }}''')
result=t.render()
print(result)
Results in this error:
Traceback (most recent call last):
File "example.py", line 9, in <module>
result = t.render()
File "/private/tmp/a/py3/lib/python3.4/site-packages/jinja2/environment.py", line 989, in render
return self.environment.handle_exception(exc_info, True)
File "/private/tmp/a/py3/lib/python3.4/site-packages/jinja2/environment.py", line 754, in handle_exception
reraise(exc_type, exc_value, tb)
File "/private/tmp/a/py3/lib/python3.4/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "<template>", line 3, in top-level template code
jinja2.exceptions.UndefinedError: 'jinja2.utils.Cycler object' has no attribute 'next'
I'm going to work around this by adding the new built-in next() function as an environment global.
The text was updated successfully, but these errors were encountered:
The
jinja2.utils.Cycler
object no longer has anext()
method in Python 3:Running the following with Python 3:
Results in this error:
I'm going to work around this by adding the new built-in
next()
function as an environment global.The text was updated successfully, but these errors were encountered: