Merge remote-tracking branch 'ThomasWaldmann/sprint-branch' into sprint-branch
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Armin Ronacher · committed by Armin Ronacher · parents 4cd6e9a, 05ace8b · Browse files · 4 files·+30 added−11 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+30 added−11 removed
- other:+30 added−11 removed
Provenance
- Commit
f6b4b04- Tree
c410c8f- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent 1
4cd6e9a- Parent 2
05ace8b
4 files changed+30 added−11 removed
modified:jinja2/_markupsafe/__init__.py+1 added-4 removed
9 unmodified lines10 """11 import re12 import six13 from six.moves import map14-try:15- unichr = unichr # py216-except NameError:17- unichr = chr # py314+from jinja2._compat import unichr15 16 __all__ = ['Markup', 'soft_unicode', 'escape', 'escape_silent']17 18 200 unmodified linesadded:jinja2/_compat.py+24 added
1+# -*- coding: utf-8 -*-2+"""3+ jinja2._compat4+ ~~~~~~~~~~~~~~5+6+ Some py2/py3 compatibility support that is not yet available in7+ "six" 1.3.0.8+ There are bugs open for "six" for all this stuff, so we can remove it9+ again from here as soon as we require a new enough "six" release.10+11+ :copyright: Copyright 2013 by the Jinja team, see AUTHORS.12+ :license: BSD, see LICENSE for details.13+"""14+15+# https://bitbucket.org/gutworth/six/issue/25/add-unichr16+try:17+ unichr = unichr # py218+except NameError:19+ unichr = chr # py320+21+try:22+ range_type = xrange23+except NameError:24+ range_type = rangemodified:jinja2/_stringdefs.py+2 added
11 unmodified lines12 :copyright: Copyright 2006-2009 by the Jinja team, see AUTHORS.13 :license: BSD, see LICENSE for details.14 """15 16+from jinja2._compat import unichr17+18 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'19 20 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'21 111 unmodified linesmodified:jinja2/compiler.py+3 added-7 removed
13 unmodified lines14 from jinja2.nodes import EvalContext15 from jinja2.visitor import NodeVisitor16 from jinja2.exceptions import TemplateAssertionError17 from jinja2.utils import Markup, concat, escape, is_python_keyword18+from jinaj2._compat import range_type19 import six20 from six.moves import cStringIO as StringIO, map21 21-# TODO: Move this to the compat module.22-try:23- range_type = xrange24-except NameError:25- range_type = range22 27-23 operators = {24 'eq': '==',25 'ne': '!=',26 'gt': '>',39 unmodified lines66 def has_safe_repr(value):67 """Does the node have a safe representation?"""68 if value is None or value is NotImplemented or value is Ellipsis:69 return True75- if isinstance(value, (bool, int, float, complex, range_type, Markup) + six.string_types):70+ if isinstance(value, (bool, int, float, complex, range_type,71+ Markup) + six.string_types):72 return True73 if isinstance(value, (tuple, list, set, frozenset)):74 for item in value:75 if not has_safe_repr(item):1563 unmodified lines