Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundle Jinja2 2.9.6 #2279

Merged
merged 1 commit into from
May 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 15 additions & 3 deletions lib/jinja2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
{% endblock %}


:copyright: (c) 2010 by the Jinja Team.
:copyright: (c) 2017 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
__docformat__ = 'restructuredtext en'
__version__ = '2.8'
__version__ = '2.9.6'

# high level interface
from jinja2.environment import Environment, Template
Expand Down Expand Up @@ -55,7 +55,7 @@
evalcontextfilter
from jinja2.utils import Markup, escape, clear_caches, \
environmentfunction, evalcontextfunction, contextfunction, \
is_undefined
is_undefined, select_autoescape

__all__ = [
'Environment', 'Template', 'BaseLoader', 'FileSystemLoader',
Expand All @@ -67,4 +67,16 @@
'ModuleLoader', 'environmentfilter', 'contextfilter', 'Markup', 'escape',
'environmentfunction', 'contextfunction', 'clear_caches', 'is_undefined',
'evalcontextfilter', 'evalcontextfunction', 'make_logging_undefined',
'select_autoescape',
]


def _patch_async():
from jinja2.utils import have_async_gen
if have_async_gen:
from jinja2.asyncsupport import patch_all
patch_all()


_patch_async()
del _patch_async
22 changes: 5 additions & 17 deletions lib/jinja2/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def reraise(tp, value, tb=None):
implements_iterator = _identity
implements_to_string = _identity
encode_filename = _identity
get_next = lambda x: x.__next__

else:
unichr = unichr
Expand Down Expand Up @@ -77,32 +76,21 @@ def implements_to_string(cls):
cls.__str__ = lambda x: x.__unicode__().encode('utf-8')
return cls

get_next = lambda x: x.next

def encode_filename(filename):
if isinstance(filename, unicode):
return filename.encode('utf-8')
return filename


def with_metaclass(meta, *bases):
"""Create a base class with a metaclass."""
# This requires a bit of explanation: the basic idea is to make a
# dummy metaclass for one level of class instanciation that replaces
# itself with the actual metaclass. Because of internal type checks
# we also need to make sure that we downgrade the custom metaclass
# for one level to something closer to type (that's why __call__ and
# __init__ comes back from type etc.).
#
# This has the advantage over six.with_metaclass in that it does not
# introduce dummy classes into the final MRO.
class metaclass(meta):
__call__ = type.__call__
__init__ = type.__init__
# dummy metaclass for one level of class instantiation that replaces
# itself with the actual metaclass.
class metaclass(type):
def __new__(cls, name, this_bases, d):
if this_bases is None:
return type.__new__(cls, name, (), d)
return meta(name, bases, d)
return metaclass('temporary_class', None, {})
return type.__new__(metaclass, 'temporary_class', (), {})


try:
Expand Down
127 changes: 33 additions & 94 deletions lib/jinja2/_stringdefs.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/jinja2/bccache.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Situations where this is useful are often forking web applications that
are initialized on the first request.

:copyright: (c) 2010 by the Jinja Team.
:copyright: (c) 2017 by the Jinja Team.
:license: BSD.
"""
from os import path, listdir
Expand Down Expand Up @@ -45,7 +45,7 @@ def marshal_load(f):
return marshal.loads(f.read())


bc_version = 2
bc_version = 3

# magic version used to only change with new jinja versions. With 2.6
# we change this to also take Python version changes into account. The
Expand Down