Commit 46493e12 authored by Julien Muchembled's avatar Julien Muchembled

jinja2: fix default context (range missing, Py2/Py3 inconsistencies)

parent c6e89947
...@@ -35,8 +35,17 @@ from . import Recipe ...@@ -35,8 +35,17 @@ from . import Recipe
DEFAULT_CONTEXT = {x.__name__: x for x in ( DEFAULT_CONTEXT = {x.__name__: x for x in (
abs, all, any, bin, bool, bytes, callable, chr, complex, dict, divmod, abs, all, any, bin, bool, bytes, callable, chr, complex, dict, divmod,
enumerate, filter, float, format, frozenset, hex, int, enumerate, filter, float, format, frozenset, hex, int,
isinstance, iter, len, list, map, max, min, next, oct, ord, isinstance, iter, len, list, map, max, min, next, oct, ord, pow,
pow, repr, reversed, round, set, six, sorted, str, sum, tuple, zip)} range, repr, reversed, round, set, six, sorted, str, sum, tuple, zip)}
if six.PY2:
import itertools
DEFAULT_CONTEXT.update(
filter=itertools.ifilter,
map=itertools.imap,
range=xrange,
zip=itertools.izip,
)
def _assert(x, *args): def _assert(x, *args):
if x: if x:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment