Commit a6378064 authored by Julien Muchembled's avatar Julien Muchembled

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

parent 81cef571
......@@ -33,10 +33,19 @@ import six
from . import Recipe
DEFAULT_CONTEXT = {x.__name__: x for x in (
abs, all, any, bin, bool, bytes, callable, chr, complex, dict, divmod,
enumerate, filter, float, format, frozenset, hex, int,
isinstance, iter, len, list, map, max, min, next, oct, ord,
pow, repr, reversed, round, set, six, sorted, str, sum, tuple, zip)}
abs, all, any, bin, bool, bytes, callable, chr, complex, dict, divmod,
enumerate, filter, float, format, frozenset, hex, int,
isinstance, iter, len, list, map, max, min, next, oct, ord, pow,
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):
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