CHANGES.rst
This file
Path
CHANGES.rst
1,072 lines · 42.0 KiB
Last changed by
deprecate `__version__` (#2098)David Lordbefore adoption9e49736
History of this fileTake it
The walk stopped after 200 commits: lines older than c580dd0 point at it.
update building docs instructions in contributing guide (#1235)sixtyfathomsbefore adoptionc580dd0
lines 1–2why, one step back1.. currentmodule:: jinja22start version 3.2.0David Lordbefore adoptione542e10
lines 3–7why, one step back3Version 3.2.04-------------56Unreleased7drop end of life python versions (#2096)David Lordbefore adoption49c48a0
line 8why, one step back8- Drop support for Python 3.7, 3.8, and 3.9.bump minimum versions of dependencies (#2097)David Lordbefore adoptiondfe82ad
lines 9–10why, one step back9- Update minimum MarkupSafe version to >= 3.0.10- Update minimum Babel version to >= 2.17.deprecate `__version__` (#2098)David Lordbefore adoption9e49736
lines 11–12why, one step back11- Deprecate the ``__version__`` attribute. Use feature detection or12 ``importlib.metadata.version("jinja2")`` instead.switch to pyproject.toml (#1793)David Lordbefore adoption05a5f81
lines 13–14why, one step back13- Use modern packaging metadata with ``pyproject.toml`` instead of ``setup.cfg``.14 :pr:`1793`switch to flit build backend (#1863)David Lordbefore adoption534c9e1
line 15why, one step back15- Use ``flit_core`` instead of ``setuptools`` as build backend.switch to pyproject.toml (#1793)David Lordbefore adoption05a5f81
line 16why, one step back16start version 3.2.0David Lordbefore adoptione542e10
line 17why, one step back17Merge branch 'stable'David Lordbefore adoption220e67a
lines 18–26why, one step back18Version 3.1.619-------------2021Released 2025-03-052223- The ``|attr`` filter does not bypass the environment's attribute lookup,24 allowing the sandbox to apply its checks. :ghsa:`cpwx-vrp4-4pq7`2526Merge branch '3.1.x'David Lordbefore adoptionb002d9c
lines 27–29why, one step back27Version 3.1.528-------------29Merge branch 'stable'David Lordbefore adoption6aeab5d
line 30why, one step back30Released 2024-12-21Merge branch '3.1.x'David Lordbefore adoptionb002d9c
line 31why, one step back31Merge branch 'stable'David Lordbefore adoption6aeab5d
lines 32–39why, one step back32- The sandboxed environment handles indirect calls to ``str.format``, such as33 by passing a stored reference to a filter that calls its argument.34 :ghsa:`q2x7-8rv6-6q7h`35- Escape template name before formatting it into error messages, to avoid36 issues with names that contain f-string syntax.37 :issue:`1792`, :ghsa:`gmj6-6f8f-6699`38- Sandbox does not allow ``clear`` and ``pop`` on known mutable sequence39 types. :issue:`2032`Merge branch '3.1.x'David Lordbefore adoptionb002d9c
lines 40–48why, one step back40- Calling sync ``render`` for an async template uses ``asyncio.run``.41 :pr:`1952`42- Avoid unclosed ``auto_aiter`` warnings. :pr:`1960`43- Return an ``aclose``-able ``AsyncGenerator`` from44 ``Template.generate_async``. :pr:`1960`45- Avoid leaving ``root_render_func()`` unclosed in46 ``Template.generate_async``. :pr:`1960`47- Avoid leaving async generators unclosed in blocks, includes and extends.48 :pr:`1960`Merge branch 'stable'David Lordbefore adoption6aeab5d
lines 49–74why, one step back49- The runtime uses the correct ``concat`` function for the current environment50 when calling block references. :issue:`1701`51- Make ``|unique`` async-aware, allowing it to be used after another52 async-aware filter. :issue:`1781`53- ``|int`` filter handles ``OverflowError`` from scientific notation.54 :issue:`1921`55- Make compiling deterministic for tuple unpacking in a ``{% set ... %}``56 call. :issue:`2021`57- Fix dunder protocol (`copy`/`pickle`/etc) interaction with ``Undefined``58 objects. :issue:`2025`59- Fix `copy`/`pickle` support for the internal ``missing`` object.60 :issue:`2027`61- ``Environment.overlay(enable_async)`` is applied correctly. :pr:`2061`62- The error message from ``FileSystemLoader`` includes the paths that were63 searched. :issue:`1661`64- ``PackageLoader`` shows a clearer error message when the package does not65 contain the templates directory. :issue:`1705`66- Improve annotations for methods returning copies. :pr:`1880`67- ``urlize`` does not add ``mailto:`` to values like `@a@b`. :pr:`1870`68- Tests decorated with `@pass_context`` can be used with the ``|select``69 filter. :issue:`1624`70- Using ``set`` for multiple assignment (``a, b = 1, 2``) does not fail when the71 target is a namespace attribute. :issue:`1413`72- Using ``set`` in all branches of ``{% if %}{% elif %}{% else %}`` blocks73 does not cause the variable to be considered initially undefined.74 :issue:`1253`Merge branch '3.1.x'David Lordbefore adoptionb002d9c
lines 75–76why, one step back7576Merge branch '3.1.x'David Lordbefore adoptionbbd5bce
lines 77–79why, one step back77Version 3.1.478-------------79Merge branch '3.1.x'David Lordbefore adoption11550f9
line 80why, one step back80Released 2024-05-05Merge branch '3.1.x'David Lordbefore adoptionbbd5bce
line 81why, one step back81Merge branch '3.1.x'David Lordbefore adoption11550f9
lines 82–86why, one step back82- The ``xmlattr`` filter does not allow keys with ``/`` solidus, ``>``83 greater-than sign, or ``=`` equals sign, in addition to disallowing spaces.84 Regardless of any validation done by Jinja, user input should never be used85 as keys to this filter, or must be separately validated first.86 :ghsa:`h75v-3vvj-5mfj`Merge branch '3.1.x'David Lordbefore adoptionbbd5bce
line 87why, one step back87Merge branch '3.1.x'David Lordbefore adoption11550f9
line 88why, one step back88Merge branch '3.1.x'David Lordbefore adoption81a2384
lines 89–91why, one step back89Version 3.1.390-------------91Merge branch '3.1.x'David Lordbefore adoption3fd91e4
line 92why, one step back92Released 2024-01-10Merge branch '3.1.x'David Lordbefore adoption81a2384
lines 93–95why, one step back9394- Fix compiler error when checking if required blocks in parent templates are95 empty. :pr:`1858`Merge branch '3.1.x'David Lordbefore adoption11550f9
line 96why, one step back96- ``xmlattr`` filter does not allow keys with spaces. :ghsa:`h5c8-rqwp-cp95`Merge branch '3.1.x'David Lordbefore adoption3fd91e4
lines 97–98why, one step back97- Make error messages stemming from invalid nesting of ``{% trans %}`` blocks98 more helpful. :pr:`1918`Merge branch '3.1.x'David Lordbefore adoption81a2384
lines 99–100why, one step back99100Merge branch '3.1.x'David Lordbefore adoptiona0dd775
lines 101–103why, one step back101Version 3.1.2102-------------103Merge branch '3.1.x'David Lordbefore adoption1b714c7
line 104why, one step back104Released 2022-04-28Merge branch '3.1.x'David Lordbefore adoptiona0dd775
lines 105–107why, one step back105106- Add parameters to ``Environment.overlay`` to match ``__init__``.107 :issue:`1645`Merge branch '3.1.x'David Lordbefore adoption52843b5
line 108why, one step back108- Handle race condition in ``FileSystemBytecodeCache``. :issue:`1654`Merge branch '3.1.x'David Lordbefore adoptiona0dd775
lines 109–110why, one step back109110Merge branch '3.1.x'David Lordbefore adoption6f79daa
lines 111–119why, one step back111Version 3.1.1112-------------113114Released 2022-03-25115116- The template filename on Windows uses the primary path separator.117 :issue:`1637`118119start version 3.1.0.dev0David Lordbefore adoptionc2d8b95
lines 120–122why, one step back120Version 3.1.0121-------------122Merge pull request #1625 from pallets/release-3.1.0David Lordbefore adoption84c0e2c
line 123why, one step back123Released 2022-03-24start version 3.1.0.dev0David Lordbefore adoptionc2d8b95
line 124why, one step back124Merge pull request #1544 from pallets/remove-deprecated-codeDavid Lordbefore adoptionb285d0c
lines 125–141why, one step back125- Drop support for Python 3.6. :pr:`1534`126- Remove previously deprecated code. :pr:`1544`127128 - ``WithExtension`` and ``AutoEscapeExtension`` are built-in now.129 - ``contextfilter`` and ``contextfunction`` are replaced by130 ``pass_context``. ``evalcontextfilter`` and131 ``evalcontextfunction`` are replaced by ``pass_eval_context``.132 ``environmentfilter`` and ``environmentfunction`` are replaced133 by ``pass_environment``.134 - ``Markup`` and ``escape`` should be imported from MarkupSafe.135 - Compiled templates from very old Jinja versions may need to be136 recompiled.137 - Legacy resolve mode for ``Context`` subclasses is no longer138 supported. Override ``resolve_or_missing`` instead of139 ``resolve``.140 - ``unicode_urlencode`` is renamed to ``url_quote``.141Merge pull request #1511 from mkrizek/issue-1510David Lordbefore adoption7d72eb7
line 142why, one step back142- Add support for native types in macros. :issue:`1510`Merge pull request #1559 from pallets/i18n-context-blockDavid Lordbefore adoption4f5c79c
lines 143–145why, one step back143- The ``{% trans %}`` tag can use ``pgettext`` and ``npgettext`` by144 passing a context string as the first token in the tag, like145 ``{% trans "title" %}``. :issue:`1430`Merge pull request #1571 from pallets/python3.7-identifier-patternDavid Lordbefore adoption077b791
lines 146–147why, one step back146- Update valid identifier characters from Python 3.6 to 3.7.147 :pr:`1571`Merge pull request #1613 from dairiki/bug.environment-not-pickleableDavid Lordbefore adoptiond5b8f66
lines 148–149why, one step back148- Filters and tests decorated with ``@async_variant`` are pickleable.149 :pr:`1612`Merge pull request #1564 from pallets/feature/pairsDavid Lordbefore adoptiona819eb3
line 150why, one step back150- Add ``items`` filter. :issue:`1561`Merge pull request #1614 from pallets/async-env-filterDavid Lordbefore adoption20eb7f5
lines 151–152why, one step back151- Subscriptions (``[0]``, etc.) can be used after filters, tests, and152 calls when the environment is in async mode. :issue:`1573`Merge pull request #1465 from wombatonfire/groupby-case-sensitiveDavid Lordbefore adoptiona12ad40
lines 153–155why, one step back153- The ``groupby`` filter is case-insensitive by default, matching154 other comparison filters. Added the ``case_sensitive`` parameter to155 control this. :issue:`1463`Merge pull request #1621 from pallets/template-safe-pathDavid Lordbefore adoptionede0f98
lines 156–158why, one step back156- Windows drive-relative path segments in template names will not157 result in ``FileSystemLoader`` and ``PackageLoader`` loading from158 drive-relative paths. :pr:`1621`Merge pull request #1511 from mkrizek/issue-1510David Lordbefore adoption7d72eb7
line 159why, one step back159start version 3.1.0.dev0David Lordbefore adoptionc2d8b95
line 160why, one step back160Merge branch '3.0.x'David Lordbefore adoptiona42b291
lines 161–177why, one step back161Version 3.0.3162-------------163164Released 2021-11-09165166- Fix traceback rewriting internals for Python 3.10 and 3.11.167 :issue:`1535`168- Fix how the native environment treats leading and trailing spaces169 when parsing values on Python 3.10. :pr:`1537`170- Improve async performance by avoiding checks for common types.171 :issue:`1514`172- Revert change to ``hash(Node)`` behavior. Nodes are hashed by id173 again :issue:`1521`174- ``PackageLoader`` works when the package is a single module file.175 :issue:`1512`176177Merge branch '3.0.x'David Lordbefore adoptioncdbda09
line 178why, one step back178Version 3.0.2start version 3.0.1.dev0David Lordbefore adoption058c06f
lines 179–180why, one step back179-------------180Merge branch '3.0.x'David Lordbefore adoptionf20a9c9
lines 181–182why, one step back181Released 2021-10-04182Merge remote-tracking branch 'origin/3.0.x'David Lordbefore adoption35c69e9
lines 183–188why, one step back183- Fix a loop scoping bug that caused assignments in nested loops184 to still be referenced outside of it. :issue:`1427`185- Make ``compile_templates`` deterministic for filter and import186 names. :issue:`1452, 1453`187- Revert an unintended change that caused ``Undefined`` to act like188 ``StrictUndefined`` for the ``in`` operator. :issue:`1448`Merge branch '3.0.x'David Lordbefore adoptionf20a9c9
lines 189–193why, one step back189- Imported macros have access to the current template globals in async190 environments. :issue:`1494`191- ``PackageLoader`` will not include a current directory (.) path192 segment. This allows loading templates from the root of a zip193 import. :issue:`1467`start version 3.0.1.dev0David Lordbefore adoption058c06f
line 194why, one step back194Merge branch '3.0.x'David Lordbefore adoptioncdbda09
lines 195–200why, one step back195196Version 3.0.1197-------------198199Released 2021-05-18200Merge pull request #1434 from pallets/update-typingDavid Lordbefore adoptiona2e83d0
lines 201–204why, one step back201- Update MarkupSafe dependency to >= 2.0. :pr:`1418`202- Mark top-level names as exported so type checking understands203 imports in user projects. :issue:`1426`204- Fix some types that weren't available in Python 3.6.0. :issue:`1433`Merge branch '3.0.x'David Lordbefore adoption55848d3
lines 205–206why, one step back205- The deprecation warning for unneeded ``autoescape`` and ``with_``206 extensions shows more relevant context. :issue:`1429`Merge pull request #1439 from pallets/deprecated-markupDavid Lordbefore adoptionab78403
lines 207–208why, one step back207- Fixed calling deprecated ``jinja2.Markup`` without an argument.208 Use ``markupsafe.Markup`` instead. :issue:`1438`Merge branch '3.1.x'David Lordbefore adoptionb002d9c
lines 209–210why, one step back209- Calling sync ``render`` for an async template uses ``asyncio.new_event_loop``210 This fixes a deprecation that Python 3.10 introduces. :issue:`1443`Merge remote-tracking branch 'origin/3.0.x'David Lordbefore adoption1c4066a
line 211why, one step back211start version 3.0.1.dev0David Lordbefore adoption058c06f
line 212why, one step back212update building docs instructions in contributing guide (#1235)sixtyfathomsbefore adoptionc580dd0
lines 213–215why, one step back213Version 3.0.0214-------------215Merge pull request #1417 from pallets/release-3.0.0David Lordbefore adoption417f822
line 216why, one step back216Released 2021-05-11update building docs instructions in contributing guide (#1235)sixtyfathomsbefore adoptionc580dd0
lines 217–221why, one step back217218- Drop support for Python 2.7 and 3.5.219- Bump MarkupSafe dependency to >=1.1.220- Bump Babel optional dependency to >=2.1.221- Remove code that was marked deprecated.Merge pull request #1412 from pallets/typingDavid Lordbefore adoption1a3342b
line 222why, one step back222- Add type hinting. :pr:`1412`update building docs instructions in contributing guide (#1235)sixtyfathomsbefore adoptionc580dd0
lines 223–243why, one step back223- Use :pep:`451` API to load templates with224 :class:`~loaders.PackageLoader`. :issue:`1168`225- Fix a bug that caused imported macros to not have access to the226 current template's globals. :issue:`688`227- Add ability to ignore ``trim_blocks`` using ``+%}``. :issue:`1036`228- Fix a bug that caused custom async-only filters to fail with229 constant input. :issue:`1279`230- Fix UndefinedError incorrectly being thrown on an undefined variable231 instead of ``Undefined`` being returned on232 ``NativeEnvironment`` on Python 3.10. :issue:`1335`233- Blocks can be marked as ``required``. They must be overridden at234 some point, but not necessarily by the direct child. :issue:`1147`235- Deprecate the ``autoescape`` and ``with`` extensions, they are236 built-in to the compiler. :issue:`1203`237- The ``urlize`` filter recognizes ``mailto:`` links and takes238 ``extra_schemes`` (or ``env.policies["urlize.extra_schemes"]``) to239 recognize other schemes. It tries to balance parentheses within a240 URL instead of ignoring trailing characters. The parsing in general241 has been updated to be more efficient and match more cases. URLs242 without a scheme are linked as ``https://`` instead of ``http://``.243 :issue:`522, 827, 1172`, :pr:`1195`Merge pull request #1356 from BALaka-18/map-filter-defaultDavid Lordbefore adoption8ab9db2
lines 244–245why, one step back244- Filters that get attributes, such as ``map`` and ``groupby``, can245 use a false or empty value as a default. :issue:`1331`Merge pull request #1242 from MLH-Fellowship/context-bugAmy Leibefore adoptionf71f5eb
lines 246–249why, one step back246- Fix a bug that prevented variables set in blocks or loops from247 being accessed in custom context functions. :issue:`768`248- Fix a bug that caused scoped blocks from accessing special loop249 variables. :issue:`1088`Merge pull request #1374 from pallets/docs-globalsDavid Lordbefore adoption1c863d0
lines 250–252why, one step back250- Update the template globals when calling251 ``Environment.get_template(globals=...)`` even if the template was252 already loaded. :issue:`295`Merge pull request #1248 from MLH-Fellowship/test-for-filterDavid Lordbefore adoptionaf5d80e
lines 253–254why, one step back253- Do not raise an error for undefined filters in unexecuted254 if-statements and conditional expressions. :issue:`842`Merge pull request #1383 from pallets/test-decoratorsDavid Lordbefore adoptionbeabf30
lines 255–257why, one step back255- Add ``is filter`` and ``is test`` tests to test if a name is a256 registered filter or test. This allows checking if a filter is257 available in a template before using it. Test functions can beMerge pull request #1389 from pallets/unify-decoratorsDavid Lordbefore adoption39846a8
lines 258–259why, one step back258 decorated with ``@pass_environment``, ``@pass_eval_context``,259 or ``@pass_context``. :issue:`842`, :pr:`1248`Merge pull request #1126 from imomaliev/pgettext-supportAdrianbefore adoption43d4228
lines 260–261why, one step back260- Support ``pgettext`` and ``npgettext`` (message contexts) in i18n261 extension. :issue:`441`Merge pull request #1167 from LarsKollstedt/allow_indent_with_generic_charDavid Lordbefore adoption1b874db
lines 262–263why, one step back262- The ``|indent`` filter's ``width`` argument can be a string to263 indent by. :pr:`1167`Merge pull request #1171 from amykyta3/feature/base-integer-literalsDavid Lordbefore adoptionfd001b2
lines 264–265why, one step back264- The parser understands hex, octal, and binary integer literals.265 :issue:`1170`Merge pull request #1204 from dparker2/undefined-containsDavid Lordbefore adoption139c3ee
lines 266–267why, one step back266- ``Undefined.__contains__`` (``in``) raises an ``UndefinedError``267 instead of a ``TypeError``. :issue:`1198`Merge pull request #1294 from Jafnee/chainableundefined-aiter-bugDavid Lordbefore adoption06c7c6f
line 268why, one step back268- ``Undefined`` is iterable in an async environment. :issue:`1294`Merge pull request #1363 from remidebette/add-native-async-supportDavid Lordbefore adoption59de6fb
line 269why, one step back269- ``NativeEnvironment`` supports async mode. :issue:`1362`Merge pull request #1366 from mvolfik/fix-unicode-newlinesDavid Lordbefore adoption4abb2a0
lines 270–271why, one step back270- Template rendering only treats ``\n``, ``\r\n`` and ``\r`` as line271 breaks. Other characters are left unchanged. :issue:`769, 952, 1313`Merge pull request #1360 from lisongmin/add-default-value-to-groupbyDavid Lordbefore adoptionc752dc8
lines 272–273why, one step back272- ``|groupby`` filter takes an optional ``default`` argument.273 :issue:`1359`Merge pull request #1389 from pallets/unify-decoratorsDavid Lordbefore adoption39846a8
lines 274–282why, one step back274- The function and filter decorators have been renamed and unified.275 The old names are deprecated. :issue:`1381`276277 - ``pass_context`` replaces ``contextfunction`` and278 ``contextfilter``.279 - ``pass_eval_context`` replaces ``evalcontextfunction`` and280 ``evalcontextfilter``281 - ``pass_environment`` replaces ``environmentfunction`` and282 ``environmentfilter``.update building docs instructions in contributing guide (#1235)sixtyfathomsbefore adoptionc580dd0
line 283why, one step back283Merge pull request #1392 from pallets/inline-asyncDavid Lordbefore adoption9d4689b
lines 284–286why, one step back284- Async support no longer requires Jinja to patch itself. It must285 still be enabled with ``Environment(enable_async=True)``.286 :issue:`1390`Merge pull request #1393 from pallets/deprecate-legacy-resolveDavid Lordbefore adoption06230b0
lines 287–288why, one step back287- Overriding ``Context.resolve`` is deprecated, override288 ``resolve_or_missing`` instead. :issue:`1380`Merge pull request #1392 from pallets/inline-asyncDavid Lordbefore adoption9d4689b
line 289why, one step back289update building docs instructions in contributing guide (#1235)sixtyfathomsbefore adoptionc580dd0
lines 290–584why, one step back290291Version 2.11.3292--------------293294Released 2021-01-31295296- Improve the speed of the ``urlize`` filter by reducing regex297 backtracking. Email matching requires a word character at the start298 of the domain part, and only word characters in the TLD. :pr:`1343`299300301Version 2.11.2302--------------303304Released 2020-04-13305306- Fix a bug that caused callable objects with ``__getattr__``, like307 :class:`~unittest.mock.Mock` to be treated as a308 :func:`contextfunction`. :issue:`1145`309- Update ``wordcount`` filter to trigger :class:`Undefined` methods310 by wrapping the input in :func:`soft_str`. :pr:`1160`311- Fix a hang when displaying tracebacks on Python 32-bit.312 :issue:`1162`313- Showing an undefined error for an object that raises314 ``AttributeError`` on access doesn't cause a recursion error.315 :issue:`1177`316- Revert changes to :class:`~loaders.PackageLoader` from 2.10 which317 removed the dependency on setuptools and pkg_resources, and added318 limited support for namespace packages. The changes caused issues319 when using Pytest. Due to the difficulty in supporting Python 2 and320 :pep:`451` simultaneously, the changes are reverted until 3.0.321 :pr:`1182`322- Fix line numbers in error messages when newlines are stripped.323 :pr:`1178`324- The special ``namespace()`` assignment object in templates works in325 async environments. :issue:`1180`326- Fix whitespace being removed before tags in the middle of lines when327 ``lstrip_blocks`` is enabled. :issue:`1138`328- :class:`~nativetypes.NativeEnvironment` doesn't evaluate329 intermediate strings during rendering. This prevents early330 evaluation which could change the value of an expression.331 :issue:`1186`332333334Version 2.11.1335--------------336337Released 2020-01-30338339- Fix a bug that prevented looking up a key after an attribute340 (``{{ data.items[1:] }}``) in an async template. :issue:`1141`341342343Version 2.11.0344--------------345346Released 2020-01-27347348- Drop support for Python 2.6, 3.3, and 3.4. This will be the last349 version to support Python 2.7 and 3.5.350- Added a new ``ChainableUndefined`` class to support getitem and351 getattr on an undefined object. :issue:`977`352- Allow ``{%+`` syntax (with NOP behavior) when ``lstrip_blocks`` is353 disabled. :issue:`748`354- Added a ``default`` parameter for the ``map`` filter. :issue:`557`355- Exclude environment globals from356 :func:`meta.find_undeclared_variables`. :issue:`931`357- Float literals can be written with scientific notation, like358 2.56e-3. :issue:`912`, :pr:`922`359- Int and float literals can be written with the '_' separator for360 legibility, like 12_345. :pr:`923`361- Fix a bug causing deadlocks in ``LRUCache.setdefault``. :pr:`1000`362- The ``trim`` filter takes an optional string of characters to trim.363 :pr:`828`364- A new ``jinja2.ext.debug`` extension adds a ``{% debug %}`` tag to365 quickly dump the current context and available filters and tests.366 :issue:`174`, :pr:`798, 983`367- Lexing templates with large amounts of whitespace is much faster.368 :issue:`857`, :pr:`858`369- Parentheses around comparisons are preserved, so370 ``{{ 2 * (3 < 5) }}`` outputs "2" instead of "False".371 :issue:`755`, :pr:`938`372- Add new ``boolean``, ``false``, ``true``, ``integer`` and ``float``373 tests. :pr:`824`374- The environment's ``finalize`` function is only applied to the375 output of expressions (constant or not), not static template data.376 :issue:`63`377- When providing multiple paths to ``FileSystemLoader``, a template378 can have the same name as a directory. :issue:`821`379- Always return :class:`Undefined` when omitting the ``else`` clause380 in a ``{{ 'foo' if bar }}`` expression, regardless of the381 environment's ``undefined`` class. Omitting the ``else`` clause is a382 valid shortcut and should not raise an error when using383 :class:`StrictUndefined`. :issue:`710`, :pr:`1079`384- Fix behavior of ``loop`` control variables such as ``length`` and385 ``revindex0`` when looping over a generator. :issue:`459, 751, 794`,386 :pr:`993`387- Async support is only loaded the first time an environment enables388 it, in order to avoid a slow initial import. :issue:`765`389- In async environments, the ``|map`` filter will await the filter390 call if needed. :pr:`913`391- In for loops that access ``loop`` attributes, the iterator is not392 advanced ahead of the current iteration unless ``length``,393 ``revindex``, ``nextitem``, or ``last`` are accessed. This makes it394 less likely to break ``groupby`` results. :issue:`555`, :pr:`1101`395- In async environments, the ``loop`` attributes ``length`` and396 ``revindex`` work for async iterators. :pr:`1101`397- In async environments, values from attribute/property access will398 be awaited if needed. :pr:`1101`399- :class:`~loader.PackageLoader` doesn't depend on setuptools or400 pkg_resources. :issue:`970`401- ``PackageLoader`` has limited support for :pep:`420` namespace402 packages. :issue:`1097`403- Support :class:`os.PathLike` objects in404 :class:`~loader.FileSystemLoader` and :class:`~loader.ModuleLoader`.405 :issue:`870`406- :class:`~nativetypes.NativeTemplate` correctly handles quotes407 between expressions. ``"'{{ a }}', '{{ b }}'"`` renders as the tuple408 ``('1', '2')`` rather than the string ``'1, 2'``. :issue:`1020`409- Creating a :class:`~nativetypes.NativeTemplate` directly creates a410 :class:`~nativetypes.NativeEnvironment` instead of a default411 :class:`Environment`. :issue:`1091`412- After calling ``LRUCache.copy()``, the copy's queue methods point to413 the correct queue. :issue:`843`414- Compiling templates always writes UTF-8 instead of defaulting to the415 system encoding. :issue:`889`416- ``|wordwrap`` filter treats existing newlines as separate paragraphs417 to be wrapped individually, rather than creating short intermediate418 lines. :issue:`175`419- Add ``break_on_hyphens`` parameter to ``|wordwrap`` filter.420 :issue:`550`421- Cython compiled functions decorated as context functions will be422 passed the context. :pr:`1108`423- When chained comparisons of constants are evaluated at compile time,424 the result follows Python's behavior of returning ``False`` if any425 comparison returns ``False``, rather than only the last one.426 :issue:`1102`427- Tracebacks for exceptions in templates show the correct line numbers428 and source for Python >= 3.7. :issue:`1104`429- Tracebacks for template syntax errors in Python 3 no longer show430 internal compiler frames. :issue:`763`431- Add a ``DerivedContextReference`` node that can be used by432 extensions to get the current context and local variables such as433 ``loop``. :issue:`860`434- Constant folding during compilation is applied to some node types435 that were previously overlooked. :issue:`733`436- ``TemplateSyntaxError.source`` is not empty when raised from an437 included template. :issue:`457`438- Passing an ``Undefined`` value to ``get_template`` (such as through439 ``extends``, ``import``, or ``include``), raises an440 ``UndefinedError`` consistently. ``select_template`` will show the441 undefined message in the list of attempts rather than the empty442 string. :issue:`1037`443- ``TemplateSyntaxError`` can be pickled. :pr:`1117`444445446Version 2.10.3447--------------448449Released 2019-10-04450451- Fix a typo in Babel entry point in ``setup.py`` that was preventing452 installation.453454455Version 2.10.2456--------------457458Released 2019-10-04459460- Fix Python 3.7 deprecation warnings.461- Using ``range`` in the sandboxed environment uses ``xrange`` on462 Python 2 to avoid memory use. :issue:`933`463- Use Python 3.7's better traceback support to avoid a core dump when464 using debug builds of Python 3.7. :issue:`1050`465466467Version 2.10.1468--------------469470Released 2019-04-06471472- ``SandboxedEnvironment`` securely handles ``str.format_map`` in473 order to prevent code execution through untrusted format strings.474 The sandbox already handled ``str.format``.475476477Version 2.10478------------479480Released 2017-11-08481482- Added a new extension node called ``OverlayScope`` which can be used483 to create an unoptimized scope that will look up all variables from484 a derived context.485- Added an ``in`` test that works like the in operator. This can be486 used in combination with ``reject`` and ``select``.487- Added ``previtem`` and ``nextitem`` to loop contexts, providing488 access to the previous/next item in the loop. If such an item does489 not exist, the value is undefined.490- Added ``changed(*values)`` to loop contexts, providing an easy way491 of checking whether a value has changed since the last iteration (or492 rather since the last call of the method)493- Added a ``namespace`` function that creates a special object which494 allows attribute assignment using the ``set`` tag. This can be used495 to carry data across scopes, e.g. from a loop body to code that496 comes after the loop.497- Added a ``trimmed`` modifier to ``{% trans %}`` to strip linebreaks498 and surrounding whitespace. Also added a new policy to enable this499 for all ``trans`` blocks.500- The ``random`` filter is no longer incorrectly constant folded and501 will produce a new random choice each time the template is rendered.502 :pr:`478`503- Added a ``unique`` filter. :pr:`469`504- Added ``min`` and ``max`` filters. :pr:`475`505- Added tests for all comparison operators: ``eq``, ``ne``, ``lt``,506 ``le``, ``gt``, ``ge``. :pr:`665`507- ``import`` statement cannot end with a trailing comma. :pr:`617`,508 :pr:`618`509- ``indent`` filter will not indent blank lines by default. :pr:`685`510- Add ``reverse`` argument for ``dictsort`` filter. :pr:`692`511- Add a ``NativeEnvironment`` that renders templates to native Python512 types instead of strings. :pr:`708`513- Added filter support to the block ``set`` tag. :pr:`489`514- ``tojson`` filter marks output as safe to match documented behavior.515 :pr:`718`516- Resolved a bug where getting debug locals for tracebacks could517 modify template context.518- Fixed a bug where having many ``{% elif ... %}`` blocks resulted in519 a "too many levels of indentation" error. These blocks now compile520 to native ``elif ..:`` instead of ``else: if ..:`` :issue:`759`521522523Version 2.9.6524-------------525526Released 2017-04-03527528- Fixed custom context behavior in fast resolve mode :issue:`675`529530531Version 2.9.5532-------------533534Released 2017-01-28535536- Restored the original repr of the internal ``_GroupTuple`` because537 this caused issues with ansible and it was an unintended change.538 :issue:`654`539- Added back support for custom contexts that override the old540 ``resolve`` method since it was hard for people to spot that this541 could cause a regression.542- Correctly use the buffer for the else block of for loops. This543 caused invalid syntax errors to be caused on 2.x and completely544 wrong behavior on Python 3 :issue:`669`545- Resolve an issue where the ``{% extends %}`` tag could not be used546 with async environments. :issue:`668`547- Reduce memory footprint slightly by reducing our unicode database548 dump we use for identifier matching on Python 3 :issue:`666`549- Fixed autoescaping not working for macros in async compilation mode.550 :issue:`671`551552553Version 2.9.4554-------------555556Released 2017-01-10557558- Solved some warnings for string literals. :issue:`646`559- Increment the bytecode cache version which was not done due to an560 oversight before.561- Corrected bad code generation and scoping for filtered loops.562 :issue:`649`563- Resolved an issue where top-level output silencing after known564 extend blocks could generate invalid code when blocks where565 contained in if statements. :issue:`651`566- Made the ``truncate.leeway`` default configurable to improve567 compatibility with older templates.568569570Version 2.9.3571-------------572573Released 2017-01-08574575- Restored the use of blocks in macros to the extend that was possible576 before. On Python 3 it would render a generator repr instead of the577 block contents. :issue:`645`578- Set a consistent behavior for assigning of variables in inner scopes579 when the variable is also read from an outer scope. This now sets580 the intended behavior in all situations however it does not restore581 the old behavior where limited assignments to outer scopes was582 possible. For more information and a discussion see :issue:`641`583- Resolved an issue where ``block scoped`` would not take advantage of584 the new scoping rules. In some more exotic cases a variableMerge branch '3.0.x'David Lordbefore adoptiona42b291
line 585why, one step back585 overridden in a local scope would not make it into a block.update building docs instructions in contributing guide (#1235)sixtyfathomsbefore adoptionc580dd0
lines 586–1061why, one step back586- Change the code generation of the ``with`` statement to be in line587 with the new scoping rules. This resolves some unlikely bugs in edge588 cases. This also introduces a new internal ``With`` node that can be589 used by extensions.590591592Version 2.9.2593-------------594595Released 2017-01-08596597- Fixed a regression that caused for loops to not be able to use the598 same variable for the target as well as source iterator.599 :issue:`640`600- Add support for a previously unknown behavior of macros. It used to601 be possible in some circumstances to explicitly provide a caller602 argument to macros. While badly buggy and unintended it turns out603 that this is a common case that gets copy pasted around. To not604 completely break backwards compatibility with the most common cases605 it's now possible to provide an explicit keyword argument for caller606 if it's given an explicit default. :issue:`642`607608609Version 2.9.1610-------------611612Released 2017-01-07613614- Resolved a regression with call block scoping for macros. Nested615 caller blocks that used the same identifiers as outer macros could616 refer to the wrong variable incorrectly.617618619Version 2.9620-----------621622Released 2017-01-07, codename Derivation623624- Change cache key definition in environment. This fixes a performance625 regression introduced in 2.8.626- Added support for ``generator_stop`` on supported Python versions627 (Python 3.5 and later)628- Corrected a long standing issue with operator precedence of math629 operations not being what was expected.630- Added support for Python 3.6 async iterators through a new async631 mode.632- Added policies for filter defaults and similar things.633- Urlize now sets "rel noopener" by default.634- Support attribute fallback for old-style classes in 2.x.635- Support toplevel set statements in extend situations.636- Restored behavior of Cycler for Python 3 users.637- Subtraction now follows the same behavior as other operators on638 undefined values.639- ``map`` and friends will now give better error messages if you640 forgot to quote the parameter.641- Depend on MarkupSafe 0.23 or higher.642- Improved the ``truncate`` filter to support better truncation in643 case the string is barely truncated at all.644- Change the logic for macro autoescaping to be based on the runtime645 autoescaping information at call time instead of macro define time.646- Ported a modified version of the ``tojson`` filter from Flask to647 Jinja and hooked it up with the new policy framework.648- Block sets are now marked ``safe`` by default.649- On Python 2 the asciification of ASCII strings can now be disabled650 with the ``compiler.ascii_str`` policy.651- Tests now no longer accept an arbitrary expression as first argument652 but a restricted one. This means that you can now properly use653 multiple tests in one expression without extra parentheses. In654 particular you can now write ``foo is divisibleby 2 or foo is655 divisibleby 3`` as you would expect.656- Greatly changed the scoping system to be more consistent with what657 template designers and developers expect. There is now no more magic658 difference between the different include and import constructs.659 Context is now always propagated the same way. The only remaining660 differences is the defaults for ``with context`` and ``without661 context``.662- The ``with`` and ``autoescape`` tags are now built-in.663- Added the new ``select_autoescape`` function which helps configuring664 better autoescaping easier.665- Fixed a runtime error in the sandbox when attributes of async666 generators were accessed.667668669Version 2.8.1670-------------671672Released 2016-12-29673674- Fixed the ``for_qs`` flag for ``urlencode``.675- Fixed regression when applying ``int`` to non-string values.676- SECURITY: if the sandbox mode is used format expressions are now677 sandboxed with the same rules as in Jinja. This solves various678 information leakage problems that can occur with format strings.679680681Version 2.8682-----------683684Released 2015-07-26, codename Replacement685686- Added ``target`` parameter to urlize function.687- Added support for ``followsymlinks`` to the file system loader.688- The truncate filter now counts the length.689- Added equalto filter that helps with select filters.690- Changed cache keys to use absolute file names if available instead691 of load names.692- Fixed loop length calculation for some iterators.693- Changed how Jinja enforces strings to be native strings in Python 2694 to work when people break their default encoding.695- Added ``make_logging_undefined`` which returns an undefined696 object that logs failures into a logger.697- If unmarshalling of cached data fails the template will be reloaded698 now.699- Implemented a block ``set`` tag.700- Default cache size was increased to 400 from a low 50.701- Fixed ``is number`` test to accept long integers in all Python702 versions.703- Changed ``is number`` to accept Decimal as a number.704- Added a check for default arguments followed by non-default705 arguments. This change makes ``{% macro m(x, y=1, z) %}`` a syntax706 error. The previous behavior for this code was broken anyway707 (resulting in the default value being applied to ``y``).708- Add ability to use custom subclasses of709 ``jinja2.compiler.CodeGenerator`` and ``jinja2.runtime.Context`` by710 adding two new attributes to the environment711 (``code_generator_class`` and ``context_class``). :pr:`404`712- Added support for context/environment/evalctx decorator functions on713 the finalize callback of the environment.714- Escape query strings for urlencode properly. Previously slashes were715 not escaped in that place.716- Add 'base' parameter to 'int' filter.717718719Version 2.7.3720-------------721722Released 2014-06-06723724- Security issue: Corrected the security fix for the cache folder.725 This fix was provided by RedHat.726727728Version 2.7.2729-------------730731Released 2014-01-10732733- Prefix loader was not forwarding the locals properly to inner734 loaders. This is now fixed.735- Security issue: Changed the default folder for the filesystem cache736 to be user specific and read and write protected on UNIX systems.737 See `Debian bug 734747`_ for more information.738739.. _Debian bug 734747: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734747740741742Version 2.7.1743-------------744745Released 2013-08-07746747- Fixed a bug with ``call_filter`` not working properly on environment748 and context filters.749- Fixed lack of Python 3 support for bytecode caches.750- Reverted support for defining blocks in included templates as this751 broke existing templates for users.752- Fixed some warnings with hashing of undefineds and nodes if Python753 is run with warnings for Python 3.754- Added support for properly hashing undefined objects.755- Fixed a bug with the title filter not working on already uppercase756 strings.757758759Version 2.7760-----------761762Released 2013-05-20, codename Translation763764- Choice and prefix loaders now dispatch source and template lookup765 separately in order to work in combination with module loaders as766 advertised.767- Fixed filesizeformat.768- Added a non-silent option for babel extraction.769- Added ``urlencode`` filter that automatically quotes values for URL770 safe usage with utf-8 as only supported encoding. If applications771 want to change this encoding they can override the filter.772- Added ``keep-trailing-newline`` configuration to environments and773 templates to optionally preserve the final trailing newline.774- Accessing ``last`` on the loop context no longer causes the iterator775 to be consumed into a list.776- Python requirement changed: 2.6, 2.7 or >= 3.3 are required now,777 supported by same source code, using the "six" compatibility778 library.779- Allow ``contextfunction`` and other decorators to be applied to780 ``__call__``.781- Added support for changing from newline to different signs in the782 ``wordwrap`` filter.783- Added support for ignoring memcache errors silently.784- Added support for keeping the trailing newline in templates.785- Added finer grained support for stripping whitespace on the left786 side of blocks.787- Added ``map``, ``select``, ``reject``, ``selectattr`` and788 ``rejectattr`` filters.789- Added support for ``loop.depth`` to figure out how deep inside a790 recursive loop the code is.791- Disabled py_compile for pypy and python 3.792793794Version 2.6795-----------796797Released 2011-07-24, codename Convolution798799- Internal attributes now raise an internal attribute error now800 instead of returning an undefined. This fixes problems when passing801 undefined objects to Python semantics expecting APIs.802- Traceback support now works properly for PyPy. (Tested with 1.4)803- Implemented operator intercepting for sandboxed environments. This804 allows application developers to disable builtin operators for805 better security. (For instance limit the mathematical operators to806 actual integers instead of longs)807- Groupby filter now supports dotted notation for grouping by808 attributes of attributes.809- Scoped blocks now properly treat toplevel assignments and imports.810 Previously an import suddenly "disappeared" in a scoped block.811- Automatically detect newer Python interpreter versions before812 loading code from bytecode caches to prevent segfaults on invalid813 opcodes. The segfault in earlier Jinja versions here was not a814 Jinja bug but a limitation in the underlying Python interpreter. If815 you notice Jinja segfaulting in earlier versions after an upgrade816 of the Python interpreter you don't have to upgrade, it's enough to817 flush the bytecode cache. This just no longer makes this necessary,818 Jinja will automatically detect these cases now.819- The sum filter can now sum up values by attribute. This is a820 backwards incompatible change. The argument to the filter previously821 was the optional starting index which defaults to zero. This now822 became the second argument to the function because it's rarely used.823- Like sum, sort now also makes it possible to order items by824 attribute.825- Like sum and sort, join now also is able to join attributes of826 objects as string.827- The internal eval context now has a reference to the environment.828- Added a mapping test to see if an object is a dict or an object with829 a similar interface.830831832Version 2.5.5833-------------834835Released 2010-10-18836837- Built documentation is no longer part of release.838839840Version 2.5.4841-------------842843Released 2010-10-17844845- Fixed extensions not loading properly with overlays.846- Work around a bug in cpython for the debugger that causes segfaults847 on 64bit big-endian architectures.848849850Version 2.5.3851-------------852853Released 2010-10-17854855- Fixed an operator precedence error introduced in 2.5.2. Statements856 like "-foo.bar" had their implicit parentheses applied around the857 first part of the expression ("(-foo).bar") instead of the more858 correct "-(foo.bar)".859860861Version 2.5.2862-------------863864Released 2010-08-18865866- Improved setup.py script to better work with assumptions people867 might still have from it (``--with-speedups``).868- Fixed a packaging error that excluded the new debug support.869870871Version 2.5.1872-------------873874Released 2010-08-17875876- StopIteration exceptions raised by functions called from templates877 are now intercepted and converted to undefineds. This solves a lot878 of debugging grief. (StopIteration is used internally to abort879 template execution)880- Improved performance of macro calls slightly.881- Babel extraction can now properly extract newstyle gettext calls.882- Using the variable ``num`` in newstyle gettext for something else883 than the pluralize count will no longer raise a :exc:`KeyError`.884- Removed builtin markup class and switched to markupsafe. For885 backwards compatibility the pure Python implementation still exists886 but is pulled from markupsafe by the Jinja developers. The debug887 support went into a separate feature called "debugsupport" and is888 disabled by default because it is only relevant for Python 2.4889- Fixed an issue with unary operators having the wrong precedence.890891892Version 2.5893-----------894895Released 2010-05-29, codename Incoherence896897- Improved the sort filter (should have worked like this for a long898 time) by adding support for case insensitive searches.899- Fixed a bug for getattribute constant folding.900- Support for newstyle gettext translations which result in a nicer901 in-template user interface and more consistent catalogs.902- It's now possible to register extensions after an environment was903 created.904905906Version 2.4.1907-------------908909Released 2010-04-20910911- Fixed an error reporting bug for undefined.912913914Version 2.4915-----------916917Released 2010-04-13, codename Correlation918919- The environment template loading functions now transparently pass920 through a template object if it was passed to it. This makes it921 possible to import or extend from a template object that was passed922 to the template.923- Added a ``ModuleLoader`` that can load templates from924 precompiled sources. The environment now features a method to925 compile the templates from a configured loader into a zip file or926 folder.927- The _speedups C extension now supports Python 3.928- Added support for autoescaping toggling sections and support for929 evaluation contexts.930- Extensions have a priority now.931932933Version 2.3.1934-------------935936Released 2010-02-19937938- Fixed an error reporting bug on all python versions939- Fixed an error reporting bug on Python 2.4940941942Version 2.3943-----------944945Released 2010-02-10, codename 3000 Pythons946947- Fixes issue with code generator that causes unbound variables to be948 generated if set was used in if-blocks and other small identifier949 problems.950- Include tags are now able to select between multiple templates and951 take the first that exists, if a list of templates is given.952- Fixed a problem with having call blocks in outer scopes that have an953 argument that is also used as local variable in an inner frame954 :issue:`360`.955- Greatly improved error message reporting :pr:`339`956- Implicit tuple expressions can no longer be totally empty. This957 change makes ``{% if %}`` a syntax error now. :issue:`364`958- Added support for translator comments if extracted via babel.959- Added with-statement extension.960- Experimental Python 3 support.961962963Version 2.2.1964-------------965966Released 2009-09-14967968- Fixes some smaller problems for Jinja on Jython.969970971Version 2.2972-----------973974Released 2009-09-13, codename Kong975976- Include statements can now be marked with ``ignore missing`` to skip977 non existing templates.978- Priority of ``not`` raised. It's now possible to write ``not foo in979 bar`` as an alias to ``foo not in bar`` like in python. Previously980 the grammar required parentheses (``not (foo in bar)``) which was981 odd.982- Fixed a bug that caused syntax errors when defining macros or using983 the ``{% call %}`` tag inside loops.984- Fixed a bug in the parser that made ``{{ foo[1, 2] }}`` impossible.985- Made it possible to refer to names from outer scopes in included986 templates that were unused in the callers frame :issue:`327`987- Fixed a bug that caused internal errors if names where used as988 iteration variable and regular variable *after* the loop if that989 variable was unused *before* the loop. :pr:`331`990- Added support for optional ``scoped`` modifier to blocks.991- Added support for line-comments.992- Added the ``meta`` module.993- Renamed (undocumented) attribute "overlay" to "overlayed" on the994 environment because it was clashing with a method of the same name.995- Speedup extension is now disabled by default.996997998Version 2.1.1999-------------10001001Released 2008-12-2510021003- Fixed a translation error caused by looping over empty recursive1004 loops.100510061007Version 2.11008-----------10091010Released 2008-11-23, codename Yasuzō10111012- Fixed a bug with nested loops and the special loop variable. Before1013 the change an inner loop overwrote the loop variable from the outer1014 one after iteration.1015- Fixed a bug with the i18n extension that caused the explicit1016 pluralization block to look up the wrong variable.1017- Fixed a limitation in the lexer that made ``{{ foo.0.0 }}``1018 impossible.1019- Index based subscribing of variables with a constant value returns1020 an undefined object now instead of raising an index error. This was1021 a bug caused by eager optimizing.1022- The i18n extension looks up ``foo.ugettext`` now followed by1023 ``foo.gettext`` if an translations object is installed. This makes1024 dealing with custom translations classes easier.1025- Fixed a confusing behavior with conditional extending. loops were1026 partially executed under some conditions even though they were not1027 part of a visible area.1028- Added ``sort`` filter that works like ``dictsort`` but for arbitrary1029 sequences.1030- Fixed a bug with empty statements in macros.1031- Implemented a bytecode cache system.1032- The template context is now weakref-able1033- Inclusions and imports "with context" forward all variables now, not1034 only the initial context.1035- Added a cycle helper called ``cycler``.1036- Added a joining helper called ``joiner``.1037- Added a ``compile_expression`` method to the environment that allows1038 compiling of Jinja expressions into callable Python objects.1039- Fixed an escaping bug in urlize104010411042Version 2.01043-----------10441045Released 2008-07-17, codename Jinjavitus10461047- The subscribing of objects (looking up attributes and items) changed1048 from slightly. It's now possible to give attributes or items a1049 higher priority by either using dot-notation lookup or the bracket1050 syntax. This also changed the AST slightly. ``Subscript`` is gone1051 and was replaced with ``Getitem`` and ``Getattr``.1052- Added support for preprocessing and token stream filtering for1053 extensions. This would allow extensions to allow simplified gettext1054 calls in template data and something similar.1055- Added ``TemplateStream.dump``.1056- Added missing support for implicit string literal concatenation.1057 ``{{ "foo" "bar" }}`` is equivalent to ``{{ "foobar" }}``1058- ``else`` is optional for conditional expressions. If not given it1059 evaluates to ``false``.1060- Improved error reporting for undefined values by providing a1061 position.Merge branch 'stable'David Lordbefore adoption6aeab5d
line 1062why, one step back1062- ``filesizeformat`` filter uses decimal prefixes now by default andupdate building docs instructions in contributing guide (#1235)sixtyfathomsbefore adoptionc580dd0
lines 1063–1072why, one step back1063 can be set to binary mode with the second parameter.1064- Fixed bug in finalizer106510661067Version 2.0rc11068--------------10691070Released 2008-06-0910711072- First release of Jinja 2.