Update Jinja2 (Python template library) to 2.7.1
Jinja2 (used in Blink scripts in Source/core and Source/bindings) has
been updated to 2.7.1 (from existing 2.6); see changelog.
http://jinja.pocoo.org/docs/changelog/
The specific new features in this release that are useful are:
* keep_trailing_newline
* lstrip_blocks
...which make it easier to control whitespace, making templates easier to read.
(Specifically it lets us easily indent control blocks.)
* selectattr (allows filtering lists in template, simplifying Python code)
In the Changelog these are referred to as:
Added support for keeping the trailing newline in templates.
Added finer grained support for stripping whitespace on the left side of blocks.
Added map, select, reject, selectattr and rejectattr filters.
BTW, 2.7 is the first Jinja2 major release in 2 years;
2.7.1 is a bugfix release:
2.7 2013-05-20
2.7.1 2013-08-07
This upgrade introduces a new dependency (on Windows), due to the safe string class being factored out into a separate library.
Thus depends on separate CL:
Add MarkupSafe library to third_party (dependency for Jinja2 2.7)
https://codereview.chromium.org/23445019/
This has been committed as r221578:
https://src.chromium.org/viewvc/chrome?view=rev&revision=221578
[email protected]
Review URL: https://chromiumcodereview.appspot.com/23506004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221663 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/third_party/jinja2/tests.py b/third_party/jinja2/tests.py
index 50510b0..48a3e06 100644
--- a/third_party/jinja2/tests.py
+++ b/third_party/jinja2/tests.py
@@ -10,26 +10,14 @@
"""
import re
from jinja2.runtime import Undefined
-
-try:
- from collections import Mapping as MappingType
-except ImportError:
- import UserDict
- MappingType = (UserDict.UserDict, UserDict.DictMixin, dict)
-
-# nose, nothing here to test
-__test__ = False
+from jinja2._compat import text_type, string_types, mapping_types
number_re = re.compile(r'^-?\d+(\.\d+)?$')
regex_type = type(number_re)
-try:
- test_callable = callable
-except NameError:
- def test_callable(x):
- return hasattr(x, '__call__')
+test_callable = callable
def test_odd(value):
@@ -76,17 +64,17 @@
def test_lower(value):
"""Return true if the variable is lowercased."""
- return unicode(value).islower()
+ return text_type(value).islower()
def test_upper(value):
"""Return true if the variable is uppercased."""
- return unicode(value).isupper()
+ return text_type(value).isupper()
def test_string(value):
"""Return true if the object is a string."""
- return isinstance(value, basestring)
+ return isinstance(value, string_types)
def test_mapping(value):
@@ -94,12 +82,12 @@
.. versionadded:: 2.6
"""
- return isinstance(value, MappingType)
+ return isinstance(value, mapping_types)
def test_number(value):
"""Return true if the variable is a number."""
- return isinstance(value, (int, long, float, complex))
+ return isinstance(value, (int, float, complex))
def test_sequence(value):