From: David Lord Date: Sat, 20 Jul 2019 21:03:04 +0000 (-0700) Subject: Merge branch '2.10.x' X-Git-Tag: 2.11.0~81 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13cc9f410c3c3f196d5e595dafe79f700a8c71c0;p=thirdparty%2Fjinja.git Merge branch '2.10.x' --- 13cc9f410c3c3f196d5e595dafe79f700a8c71c0 diff --cc CHANGES.rst index 0042a501,78e13294..b3b667d6 --- a/CHANGES.rst +++ b/CHANGES.rst @@@ -4,23 -2,13 +4,30 @@@ Jinja Changelo =============== +Version 2.11 +------------ + +unreleased + +- Async support is only loaded the first time an + :class:`~environment.Environment` enables it, in order to avoid a + slow initial import. (`#765`_) +- Python 2.6 and 3.3 are not supported anymore. +- The ``map`` filter in async mode now automatically awaits +- Added a new ``ChainableUndefined`` class to support getitem + and getattr on an undefined object. (`#977`_) + +.. _#765: https://github.com/pallets/jinja/issues/765 +.. _#977: https://github.com/pallets/jinja/issues/977 + + + Version 2.10.2 + -------------- + + _Unreleased_ + + - Fix Python 3.7 deprecation warnings. + Version 2.10.1 -------------- diff --cc docs/templates.rst index bc18d998,345344e0..cb20ba2c --- a/docs/templates.rst +++ b/docs/templates.rst @@@ -1351,11 -1312,33 +1352,33 @@@ something else>`` The `else` part is optional. If not provided, the else block implicitly evaluates into an undefined object: -.. sourcecode:: jinja +.. code-block:: text - {{ '[%s]' % page.title if page.title }} + {{ ('[%s]' % page.title) if page.title }} + .. _python-methods: + + Python Methods + ~~~~~~~~~~~~~~ + + You can also use any of the methods of defined on a variable's type. + The value returned from the method invocation is used as the value of the expression. + Here is an example that uses methods defined on strings (where ``page.title`` is a string): + + .. code-block:: text + + {{ page.title.capitalize() }} + + This also works for methods on user-defined types. + For example, if variable ``f`` of type ``Foo`` has a method ``bar`` defined on it, + you can do the following: + + .. code-block:: text + + {{ f.bar() }} + + .. _builtin-filters: List of Builtin Filters