]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
new jinja2._compat module for stuff not yet in six 1.3.0
authorThomas Waldmann <tw@waldmann-edv.de>
Sat, 18 May 2013 11:08:53 +0000 (13:08 +0200)
committerThomas Waldmann <tw@waldmann-edv.de>
Sat, 18 May 2013 11:08:53 +0000 (13:08 +0200)
jinja2/_compat.py [new file with mode: 0644]
jinja2/_markupsafe/__init__.py
jinja2/_stringdefs.py

diff --git a/jinja2/_compat.py b/jinja2/_compat.py
new file mode 100644 (file)
index 0000000..61619a8
--- /dev/null
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+"""
+    jinja2._compat
+    ~~~~~~~~~~~~~~
+
+    Some py2/py3 compatibility support that is not yet available in "six".
+    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
index b14d279d8b86d66c03fcd62f6412584926d7fd14..49775f656c16329245f0f6c76e31604122f0caa0 100644 (file)
@@ -12,10 +12,7 @@ import re
 import six
 from six.moves import map
 from six.moves import zip
-try:
-    unichr = unichr  # py2
-except NameError:
-    unichr = chr  # py3
+from jinja2._compat import unichr
 
 __all__ = ['Markup', 'soft_unicode', 'escape', 'escape_silent']
 
index 1161b7f4a47d444963fdc77ae3c92187b3354430..da5830e9f19fd7ddaeebd318bcf6f29847c5a15e 100644 (file)
@@ -13,6 +13,8 @@
     :license: BSD, see LICENSE for details.
 """
 
+from jinja2._compat import unichr
+
 Cc = u'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f'
 
 Cf = u'\xad\u0600\u0601\u0602\u0603\u06dd\u070f\u17b4\u17b5\u200b\u200c\u200d\u200e\u200f\u202a\u202b\u202c\u202d\u202e\u2060\u2061\u2062\u2063\u206a\u206b\u206c\u206d\u206e\u206f\ufeff\ufff9\ufffa\ufffb'