]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
Merge remote-tracking branch 'ThomasWaldmann/sprint-branch' into sprint-branch
authorArmin Ronacher <armin.ronacher@active-4.com>
Sat, 18 May 2013 11:23:30 +0000 (12:23 +0100)
committerArmin Ronacher <armin.ronacher@active-4.com>
Sat, 18 May 2013 11:23:30 +0000 (12:23 +0100)
1  2 
jinja2/_compat.py
jinja2/_markupsafe/__init__.py
jinja2/compiler.py

index 0000000000000000000000000000000000000000,a73875743c5616c66918ac4f1421a7f8ed821bf4..6318f0b1acd17ebc4ec7cfae754e07f046f65bd1
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,19 +1,24 @@@
+ # -*- coding: utf-8 -*-
+ """
+     jinja2._compat
+     ~~~~~~~~~~~~~~
+     Some py2/py3 compatibility support that is not yet available in
+      "six" 1.3.0.
+     There are bugs open for "six" for all this stuff, so we can remove it
+     again from here as soon as we require a new enough "six" release.
+     :copyright: Copyright 2013 by the Jinja team, see AUTHORS.
+     :license: BSD, see LICENSE for details.
+ """
+ # https://bitbucket.org/gutworth/six/issue/25/add-unichr
+ try:
+     unichr = unichr  # py2
+ except NameError:
+     unichr = chr  # py3
++
++try:
++    range_type = xrange
++except NameError:
++    range_type = range
index c3062b82f26675e30543d2e0116caf09c76263b4,49775f656c16329245f0f6c76e31604122f0caa0..5ffb57d7b9a1046760f3d6a75c5a22376b5cb7d3
  import re
  import six
  from six.moves import map
- try:
-     unichr = unichr  # py2
- except NameError:
-     unichr = chr  # py3
 -from six.moves import zip
+ from jinja2._compat import unichr
  
  __all__ = ['Markup', 'soft_unicode', 'escape', 'escape_silent']
  
index 47bd6ec237909b4c97cbf0c70ef66c5e72ae0164,1b1b5a7514fe4164dc94d687e0ee77bb9fe670b8..ec6690833f1966c54b5c310dc336ca90b9ee32ef
@@@ -15,15 -15,11 +15,10 @@@ from jinja2.nodes import EvalContex
  from jinja2.visitor import NodeVisitor
  from jinja2.exceptions import TemplateAssertionError
  from jinja2.utils import Markup, concat, escape, is_python_keyword
++from jinaj2._compat import range_type
  import six
 -from six.moves import cStringIO as StringIO
 -from six.moves import map, zip
 -from six.moves import xrange
 +from six.moves import cStringIO as StringIO, map
  
- # TODO: Move this to the compat module.
- try:
-     range_type = xrange
- except NameError:
-     range_type = range
  
  operators = {
      'eq':       '==',
@@@ -72,7 -76,7 +67,8 @@@ 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
-     if isinstance(value, (bool, int, float, complex, range_type, Markup) + six.string_types):
 -    if isinstance(value, (bool, int, float, complex, xrange, Markup) + six.string_types):
++    if isinstance(value, (bool, int, float, complex, range_type,
++            Markup) + six.string_types):
          return True
      if isinstance(value, (tuple, list, set, frozenset)):
          for item in value: