From: Cory Benfield Date: Sat, 18 May 2013 10:41:24 +0000 (+0100) Subject: Don't assign the range type each time. X-Git-Tag: 2.7~73^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F214%2Fhead;p=thirdparty%2Fjinja.git Don't assign the range type each time. --- diff --git a/jinja2/compiler.py b/jinja2/compiler.py index 4ee39f89..64a75cc3 100644 --- a/jinja2/compiler.py +++ b/jinja2/compiler.py @@ -19,6 +19,12 @@ import six from six.moves import cStringIO as StringIO from six.moves import map, zip +# TODO: Move this to the compat module. +try: + range_type = xrange +except NameError: + range_type = range + operators = { 'eq': '==', @@ -71,10 +77,6 @@ def has_safe_repr(value): """Does the node have a safe representation?""" if value is None or value is NotImplemented or value is Ellipsis: return True - try: - range_type = xrange - except NameError: - range_type = range if isinstance(value, (bool, int, float, complex, range_type, Markup) + six.string_types): return True if isinstance(value, (tuple, list, set, frozenset)):