1.. currentmodule:: jinja2 2 3Version 3.1.3 4------------- 5 6Released 2024-01-10 7 8- Fix compiler error when checking if required blocks in parent templates are 9 empty. :pr:`1858` 10- ``xmlattr`` filter does not allow keys with spaces. GHSA-h5c8-rqwp-cp95 11- Make error messages stemming from invalid nesting of ``{% trans %}`` blocks 12 more helpful. :pr:`1916` 13 14 15Version 3.1.2 16------------- 17 18Released 2022-04-28 19 20- Add parameters to ``Environment.overlay`` to match ``__init__``. 21 :issue:`1645` 22- Handle race condition in ``FileSystemBytecodeCache``. :issue:`1654` 23 24 25Version 3.1.1 26------------- 27 28Released 2022-03-25 29 30- The template filename on Windows uses the primary path separator. 31 :issue:`1637` 32 33 34Version 3.1.0 35------------- 36 37Released 2022-03-24 38 39- Drop support for Python 3.6. :pr:`1534` 40- Remove previously deprecated code. :pr:`1544` 41 42 - ``WithExtension`` and ``AutoEscapeExtension`` are built-in now. 43 - ``contextfilter`` and ``contextfunction`` are replaced by 44 ``pass_context``. ``evalcontextfilter`` and 45 ``evalcontextfunction`` are replaced by ``pass_eval_context``. 46 ``environmentfilter`` and ``environmentfunction`` are replaced 47 by ``pass_environment``. 48 - ``Markup`` and ``escape`` should be imported from MarkupSafe. 49 - Compiled templates from very old Jinja versions may need to be 50 recompiled. 51 - Legacy resolve mode for ``Context`` subclasses is no longer 52 supported. Override ``resolve_or_missing`` instead of 53 ``resolve``. 54 - ``unicode_urlencode`` is renamed to ``url_quote``. 55 56- Add support for native types in macros. :issue:`1510` 57- The ``{% trans %}`` tag can use ``pgettext`` and ``npgettext`` by 58 passing a context string as the first token in the tag, like 59 ``{% trans "title" %}``. :issue:`1430` 60- Update valid identifier characters from Python 3.6 to 3.7. 61 :pr:`1571` 62- Filters and tests decorated with ``@async_variant`` are pickleable. 63 :pr:`1612` 64- Add ``items`` filter. :issue:`1561` 65- Subscriptions (``[0]``, etc.) can be used after filters, tests, and 66 calls when the environment is in async mode. :issue:`1573` 67- The ``groupby`` filter is case-insensitive by default, matching 68 other comparison filters. Added the ``case_sensitive`` parameter to 69 control this. :issue:`1463` 70- Windows drive-relative path segments in template names will not 71 result in ``FileSystemLoader`` and ``PackageLoader`` loading from 72 drive-relative paths. :pr:`1621` 73 74 75Version 3.0.3 76------------- 77 78Released 2021-11-09 79 80- Fix traceback rewriting internals for Python 3.10 and 3.11. 81 :issue:`1535` 82- Fix how the native environment treats leading and trailing spaces 83 when parsing values on Python 3.10. :pr:`1537` 84- Improve async performance by avoiding checks for common types. 85 :issue:`1514` 86- Revert change to ``hash(Node)`` behavior. Nodes are hashed by id 87 again :issue:`1521` 88- ``PackageLoader`` works when the package is a single module file. 89 :issue:`1512` 90 91 92Version 3.0.2 93------------- 94 95Released 2021-10-04 96 97- Fix a loop scoping bug that caused assignments in nested loops 98 to still be referenced outside of it. :issue:`1427` 99- Make ``compile_templates`` deterministic for filter and import 100 names. :issue:`1452, 1453` 101- Revert an unintended change that caused ``Undefined`` to act like 102 ``StrictUndefined`` for the ``in`` operator. :issue:`1448` 103- Imported macros have access to the current template globals in async 104 environments. :issue:`1494` 105- ``PackageLoader`` will not include a current directory (.) path 106 segment. This allows loading templates from the root of a zip 107 import. :issue:`1467` 108 109 110Version 3.0.1 111------------- 112 113Released 2021-05-18 114 115- Update MarkupSafe dependency to >= 2.0. :pr:`1418` 116- Mark top-level names as exported so type checking understands 117 imports in user projects. :issue:`1426` 118- Fix some types that weren't available in Python 3.6.0. :issue:`1433` 119- The deprecation warning for unneeded ``autoescape`` and ``with_`` 120 extensions shows more relevant context. :issue:`1429` 121- Fixed calling deprecated ``jinja2.Markup`` without an argument. 122 Use ``markupsafe.Markup`` instead. :issue:`1438` 123- Calling sync ``render`` for an async template uses ``asyncio.run`` 124 on Python >= 3.7. This fixes a deprecation that Python 3.10 125 introduces. :issue:`1443` 126 127 128Version 3.0.0 129------------- 130 131Released 2021-05-11 132 133- Drop support for Python 2.7 and 3.5. 134- Bump MarkupSafe dependency to >=1.1. 135- Bump Babel optional dependency to >=2.1. 136- Remove code that was marked deprecated. 137- Add type hinting. :pr:`1412` 138- Use :pep:`451` API to load templates with 139 :class:`~loaders.PackageLoader`. :issue:`1168` 140- Fix a bug that caused imported macros to not have access to the 141 current template's globals. :issue:`688` 142- Add ability to ignore ``trim_blocks`` using ``+%}``. :issue:`1036` 143- Fix a bug that caused custom async-only filters to fail with 144 constant input. :issue:`1279` 145- Fix UndefinedError incorrectly being thrown on an undefined variable 146 instead of ``Undefined`` being returned on 147 ``NativeEnvironment`` on Python 3.10. :issue:`1335` 148- Blocks can be marked as ``required``. They must be overridden at 149 some point, but not necessarily by the direct child. :issue:`1147` 150- Deprecate the ``autoescape`` and ``with`` extensions, they are 151 built-in to the compiler. :issue:`1203` 152- The ``urlize`` filter recognizes ``mailto:`` links and takes 153 ``extra_schemes`` (or ``env.policies["urlize.extra_schemes"]``) to 154 recognize other schemes. It tries to balance parentheses within a 155 URL instead of ignoring trailing characters. The parsing in general 156 has been updated to be more efficient and match more cases. URLs 157 without a scheme are linked as ``https://`` instead of ``http://``. 158 :issue:`522, 827, 1172`, :pr:`1195` 159- Filters that get attributes, such as ``map`` and ``groupby``, can 160 use a false or empty value as a default. :issue:`1331` 161- Fix a bug that prevented variables set in blocks or loops from 162 being accessed in custom context functions. :issue:`768` 163- Fix a bug that caused scoped blocks from accessing special loop 164 variables. :issue:`1088` 165- Update the template globals when calling 166 ``Environment.get_template(globals=...)`` even if the template was 167 already loaded. :issue:`295` 168- Do not raise an error for undefined filters in unexecuted 169 if-statements and conditional expressions. :issue:`842` 170- Add ``is filter`` and ``is test`` tests to test if a name is a 171 registered filter or test. This allows checking if a filter is 172 available in a template before using it. Test functions can be 173 decorated with ``@pass_environment``, ``@pass_eval_context``, 174 or ``@pass_context``. :issue:`842`, :pr:`1248` 175- Support ``pgettext`` and ``npgettext`` (message contexts) in i18n 176 extension. :issue:`441` 177- The ``|indent`` filter's ``width`` argument can be a string to 178 indent by. :pr:`1167` 179- The parser understands hex, octal, and binary integer literals. 180 :issue:`1170` 181- ``Undefined.__contains__`` (``in``) raises an ``UndefinedError`` 182 instead of a ``TypeError``. :issue:`1198` 183- ``Undefined`` is iterable in an async environment. :issue:`1294` 184- ``NativeEnvironment`` supports async mode. :issue:`1362` 185- Template rendering only treats ``\n``, ``\r\n`` and ``\r`` as line 186 breaks. Other characters are left unchanged. :issue:`769, 952, 1313` 187- ``|groupby`` filter takes an optional ``default`` argument. 188 :issue:`1359` 189- The function and filter decorators have been renamed and unified. 190 The old names are deprecated. :issue:`1381` 191 192 - ``pass_context`` replaces ``contextfunction`` and 193 ``contextfilter``. 194 - ``pass_eval_context`` replaces ``evalcontextfunction`` and 195 ``evalcontextfilter`` 196 - ``pass_environment`` replaces ``environmentfunction`` and 197 ``environmentfilter``. 198 199- Async support no longer requires Jinja to patch itself. It must 200 still be enabled with ``Environment(enable_async=True)``. 201 :issue:`1390` 202- Overriding ``Context.resolve`` is deprecated, override 203 ``resolve_or_missing`` instead. :issue:`1380` 204 205 206Version 2.11.3 207-------------- 208 209Released 2021-01-31 210 211- Improve the speed of the ``urlize`` filter by reducing regex 212 backtracking. Email matching requires a word character at the start 213 of the domain part, and only word characters in the TLD. :pr:`1343` 214 215 216Version 2.11.2 217-------------- 218 219Released 2020-04-13 220 221- Fix a bug that caused callable objects with ``__getattr__``, like 222 :class:`~unittest.mock.Mock` to be treated as a 223 :func:`contextfunction`. :issue:`1145` 224- Update ``wordcount`` filter to trigger :class:`Undefined` methods 225 by wrapping the input in :func:`soft_str`. :pr:`1160` 226- Fix a hang when displaying tracebacks on Python 32-bit. 227 :issue:`1162` 228- Showing an undefined error for an object that raises 229 ``AttributeError`` on access doesn't cause a recursion error. 230 :issue:`1177` 231- Revert changes to :class:`~loaders.PackageLoader` from 2.10 which 232 removed the dependency on setuptools and pkg_resources, and added 233 limited support for namespace packages. The changes caused issues 234 when using Pytest. Due to the difficulty in supporting Python 2 and 235 :pep:`451` simultaneously, the changes are reverted until 3.0. 236 :pr:`1182` 237- Fix line numbers in error messages when newlines are stripped. 238 :pr:`1178` 239- The special ``namespace()`` assignment object in templates works in 240 async environments. :issue:`1180` 241- Fix whitespace being removed before tags in the middle of lines when 242 ``lstrip_blocks`` is enabled. :issue:`1138` 243- :class:`~nativetypes.NativeEnvironment` doesn't evaluate 244 intermediate strings during rendering. This prevents early 245 evaluation which could change the value of an expression. 246 :issue:`1186` 247 248 249Version 2.11.1 250-------------- 251 252Released 2020-01-30 253 254- Fix a bug that prevented looking up a key after an attribute 255 (``{{ data.items[1:] }}``) in an async template. :issue:`1141` 256 257 258Version 2.11.0 259-------------- 260 261Released 2020-01-27 262 263- Drop support for Python 2.6, 3.3, and 3.4. This will be the last 264 version to support Python 2.7 and 3.5. 265- Added a new ``ChainableUndefined`` class to support getitem and 266 getattr on an undefined object. :issue:`977` 267- Allow ``{%+`` syntax (with NOP behavior) when ``lstrip_blocks`` is 268 disabled. :issue:`748` 269- Added a ``default`` parameter for the ``map`` filter. :issue:`557` 270- Exclude environment globals from 271 :func:`meta.find_undeclared_variables`. :issue:`931` 272- Float literals can be written with scientific notation, like 273 2.56e-3. :issue:`912`, :pr:`922` 274- Int and float literals can be written with the '_' separator for 275 legibility, like 12_345. :pr:`923` 276- Fix a bug causing deadlocks in ``LRUCache.setdefault``. :pr:`1000` 277- The ``trim`` filter takes an optional string of characters to trim. 278 :pr:`828` 279- A new ``jinja2.ext.debug`` extension adds a ``{% debug %}`` tag to 280 quickly dump the current context and available filters and tests. 281 :issue:`174`, :pr:`798, 983` 282- Lexing templates with large amounts of whitespace is much faster. 283 :issue:`857`, :pr:`858` 284- Parentheses around comparisons are preserved, so 285 ``{{ 2 * (3 < 5) }}`` outputs "2" instead of "False". 286 :issue:`755`, :pr:`938` 287- Add new ``boolean``, ``false``, ``true``, ``integer`` and ``float`` 288 tests. :pr:`824` 289- The environment's ``finalize`` function is only applied to the 290 output of expressions (constant or not), not static template data. 291 :issue:`63` 292- When providing multiple paths to ``FileSystemLoader``, a template 293 can have the same name as a directory. :issue:`821` 294- Always return :class:`Undefined` when omitting the ``else`` clause 295 in a ``{{ 'foo' if bar }}`` expression, regardless of the 296 environment's ``undefined`` class. Omitting the ``else`` clause is a 297 valid shortcut and should not raise an error when using 298 :class:`StrictUndefined`. :issue:`710`, :pr:`1079` 299- Fix behavior of ``loop`` control variables such as ``length`` and 300 ``revindex0`` when looping over a generator. :issue:`459, 751, 794`, 301 :pr:`993` 302- Async support is only loaded the first time an environment enables 303 it, in order to avoid a slow initial import. :issue:`765` 304- In async environments, the ``|map`` filter will await the filter 305 call if needed. :pr:`913` 306- In for loops that access ``loop`` attributes, the iterator is not 307 advanced ahead of the current iteration unless ``length``, 308 ``revindex``, ``nextitem``, or ``last`` are accessed. This makes it 309 less likely to break ``groupby`` results. :issue:`555`, :pr:`1101` 310- In async environments, the ``loop`` attributes ``length`` and 311 ``revindex`` work for async iterators. :pr:`1101` 312- In async environments, values from attribute/property access will 313 be awaited if needed. :pr:`1101` 314- :class:`~loader.PackageLoader` doesn't depend on setuptools or 315 pkg_resources. :issue:`970` 316- ``PackageLoader`` has limited support for :pep:`420` namespace 317 packages. :issue:`1097` 318- Support :class:`os.PathLike` objects in 319 :class:`~loader.FileSystemLoader` and :class:`~loader.ModuleLoader`. 320 :issue:`870` 321- :class:`~nativetypes.NativeTemplate` correctly handles quotes 322 between expressions. ``"'{{ a }}', '{{ b }}'"`` renders as the tuple 323 ``('1', '2')`` rather than the string ``'1, 2'``. :issue:`1020` 324- Creating a :class:`~nativetypes.NativeTemplate` directly creates a 325 :class:`~nativetypes.NativeEnvironment` instead of a default 326 :class:`Environment`. :issue:`1091` 327- After calling ``LRUCache.copy()``, the copy's queue methods point to 328 the correct queue. :issue:`843` 329- Compiling templates always writes UTF-8 instead of defaulting to the 330 system encoding. :issue:`889` 331- ``|wordwrap`` filter treats existing newlines as separate paragraphs 332 to be wrapped individually, rather than creating short intermediate 333 lines. :issue:`175` 334- Add ``break_on_hyphens`` parameter to ``|wordwrap`` filter. 335 :issue:`550` 336- Cython compiled functions decorated as context functions will be 337 passed the context. :pr:`1108` 338- When chained comparisons of constants are evaluated at compile time, 339 the result follows Python's behavior of returning ``False`` if any 340 comparison returns ``False``, rather than only the last one. 341 :issue:`1102` 342- Tracebacks for exceptions in templates show the correct line numbers 343 and source for Python >= 3.7. :issue:`1104` 344- Tracebacks for template syntax errors in Python 3 no longer show 345 internal compiler frames. :issue:`763` 346- Add a ``DerivedContextReference`` node that can be used by 347 extensions to get the current context and local variables such as 348 ``loop``. :issue:`860` 349- Constant folding during compilation is applied to some node types 350 that were previously overlooked. :issue:`733` 351- ``TemplateSyntaxError.source`` is not empty when raised from an 352 included template. :issue:`457` 353- Passing an ``Undefined`` value to ``get_template`` (such as through 354 ``extends``, ``import``, or ``include``), raises an 355 ``UndefinedError`` consistently. ``select_template`` will show the 356 undefined message in the list of attempts rather than the empty 357 string. :issue:`1037` 358- ``TemplateSyntaxError`` can be pickled. :pr:`1117` 359 360 361Version 2.10.3 362-------------- 363 364Released 2019-10-04 365 366- Fix a typo in Babel entry point in ``setup.py`` that was preventing 367 installation. 368 369 370Version 2.10.2 371-------------- 372 373Released 2019-10-04 374 375- Fix Python 3.7 deprecation warnings. 376- Using ``range`` in the sandboxed environment uses ``xrange`` on 377 Python 2 to avoid memory use. :issue:`933` 378- Use Python 3.7's better traceback support to avoid a core dump when 379 using debug builds of Python 3.7. :issue:`1050` 380 381 382Version 2.10.1 383-------------- 384 385Released 2019-04-06 386 387- ``SandboxedEnvironment`` securely handles ``str.format_map`` in 388 order to prevent code execution through untrusted format strings. 389 The sandbox already handled ``str.format``. 390 391 392Version 2.10 393------------ 394 395Released 2017-11-08 396 397- Added a new extension node called ``OverlayScope`` which can be used 398 to create an unoptimized scope that will look up all variables from 399 a derived context. 400- Added an ``in`` test that works like the in operator. This can be 401 used in combination with ``reject`` and ``select``. 402- Added ``previtem`` and ``nextitem`` to loop contexts, providing 403 access to the previous/next item in the loop. If such an item does 404 not exist, the value is undefined. 405- Added ``changed(*values)`` to loop contexts, providing an easy way 406 of checking whether a value has changed since the last iteration (or 407 rather since the last call of the method) 408- Added a ``namespace`` function that creates a special object which 409 allows attribute assignment using the ``set`` tag. This can be used 410 to carry data across scopes, e.g. from a loop body to code that 411 comes after the loop. 412- Added a ``trimmed`` modifier to ``{% trans %}`` to strip linebreaks 413 and surrounding whitespace. Also added a new policy to enable this 414 for all ``trans`` blocks. 415- The ``random`` filter is no longer incorrectly constant folded and 416 will produce a new random choice each time the template is rendered. 417 :pr:`478` 418- Added a ``unique`` filter. :pr:`469` 419- Added ``min`` and ``max`` filters. :pr:`475` 420- Added tests for all comparison operators: ``eq``, ``ne``, ``lt``, 421 ``le``, ``gt``, ``ge``. :pr:`665` 422- ``import`` statement cannot end with a trailing comma. :pr:`617`, 423 :pr:`618` 424- ``indent`` filter will not indent blank lines by default. :pr:`685` 425- Add ``reverse`` argument for ``dictsort`` filter. :pr:`692` 426- Add a ``NativeEnvironment`` that renders templates to native Python 427 types instead of strings. :pr:`708` 428- Added filter support to the block ``set`` tag. :pr:`489` 429- ``tojson`` filter marks output as safe to match documented behavior. 430 :pr:`718` 431- Resolved a bug where getting debug locals for tracebacks could 432 modify template context. 433- Fixed a bug where having many ``{% elif ... %}`` blocks resulted in 434 a "too many levels of indentation" error. These blocks now compile 435 to native ``elif ..:`` instead of ``else: if ..:`` :issue:`759` 436 437 438Version 2.9.6 439------------- 440 441Released 2017-04-03 442 443- Fixed custom context behavior in fast resolve mode :issue:`675` 444 445 446Version 2.9.5 447------------- 448 449Released 2017-01-28 450 451- Restored the original repr of the internal ``_GroupTuple`` because 452 this caused issues with ansible and it was an unintended change. 453 :issue:`654` 454- Added back support for custom contexts that override the old 455 ``resolve`` method since it was hard for people to spot that this 456 could cause a regression. 457- Correctly use the buffer for the else block of for loops. This 458 caused invalid syntax errors to be caused on 2.x and completely 459 wrong behavior on Python 3 :issue:`669` 460- Resolve an issue where the ``{% extends %}`` tag could not be used 461 with async environments. :issue:`668` 462- Reduce memory footprint slightly by reducing our unicode database 463 dump we use for identifier matching on Python 3 :issue:`666` 464- Fixed autoescaping not working for macros in async compilation mode. 465 :issue:`671` 466 467 468Version 2.9.4 469------------- 470 471Released 2017-01-10 472 473- Solved some warnings for string literals. :issue:`646` 474- Increment the bytecode cache version which was not done due to an 475 oversight before. 476- Corrected bad code generation and scoping for filtered loops. 477 :issue:`649` 478- Resolved an issue where top-level output silencing after known 479 extend blocks could generate invalid code when blocks where 480 contained in if statements. :issue:`651` 481- Made the ``truncate.leeway`` default configurable to improve 482 compatibility with older templates. 483 484 485Version 2.9.3 486------------- 487 488Released 2017-01-08 489 490- Restored the use of blocks in macros to the extend that was possible 491 before. On Python 3 it would render a generator repr instead of the 492 block contents. :issue:`645` 493- Set a consistent behavior for assigning of variables in inner scopes 494 when the variable is also read from an outer scope. This now sets 495 the intended behavior in all situations however it does not restore 496 the old behavior where limited assignments to outer scopes was 497 possible. For more information and a discussion see :issue:`641` 498- Resolved an issue where ``block scoped`` would not take advantage of 499 the new scoping rules. In some more exotic cases a variable 500 overridden in a local scope would not make it into a block. 501- Change the code generation of the ``with`` statement to be in line 502 with the new scoping rules. This resolves some unlikely bugs in edge 503 cases. This also introduces a new internal ``With`` node that can be 504 used by extensions. 505 506 507Version 2.9.2 508------------- 509 510Released 2017-01-08 511 512- Fixed a regression that caused for loops to not be able to use the 513 same variable for the target as well as source iterator. 514 :issue:`640` 515- Add support for a previously unknown behavior of macros. It used to 516 be possible in some circumstances to explicitly provide a caller 517 argument to macros. While badly buggy and unintended it turns out 518 that this is a common case that gets copy pasted around. To not 519 completely break backwards compatibility with the most common cases 520 it's now possible to provide an explicit keyword argument for caller 521 if it's given an explicit default. :issue:`642` 522 523 524Version 2.9.1 525------------- 526 527Released 2017-01-07 528 529- Resolved a regression with call block scoping for macros. Nested 530 caller blocks that used the same identifiers as outer macros could 531 refer to the wrong variable incorrectly. 532 533 534Version 2.9 535----------- 536 537Released 2017-01-07, codename Derivation 538 539- Change cache key definition in environment. This fixes a performance 540 regression introduced in 2.8. 541- Added support for ``generator_stop`` on supported Python versions 542 (Python 3.5 and later) 543- Corrected a long standing issue with operator precedence of math 544 operations not being what was expected. 545- Added support for Python 3.6 async iterators through a new async 546 mode. 547- Added policies for filter defaults and similar things. 548- Urlize now sets "rel noopener" by default. 549- Support attribute fallback for old-style classes in 2.x. 550- Support toplevel set statements in extend situations. 551- Restored behavior of Cycler for Python 3 users. 552- Subtraction now follows the same behavior as other operators on 553 undefined values. 554- ``map`` and friends will now give better error messages if you 555 forgot to quote the parameter. 556- Depend on MarkupSafe 0.23 or higher. 557- Improved the ``truncate`` filter to support better truncation in 558 case the string is barely truncated at all. 559- Change the logic for macro autoescaping to be based on the runtime 560 autoescaping information at call time instead of macro define time. 561- Ported a modified version of the ``tojson`` filter from Flask to 562 Jinja and hooked it up with the new policy framework. 563- Block sets are now marked ``safe`` by default. 564- On Python 2 the asciification of ASCII strings can now be disabled 565 with the ``compiler.ascii_str`` policy. 566- Tests now no longer accept an arbitrary expression as first argument 567 but a restricted one. This means that you can now properly use 568 multiple tests in one expression without extra parentheses. In 569 particular you can now write ``foo is divisibleby 2 or foo is 570 divisibleby 3`` as you would expect. 571- Greatly changed the scoping system to be more consistent with what 572 template designers and developers expect. There is now no more magic 573 difference between the different include and import constructs. 574 Context is now always propagated the same way. The only remaining 575 differences is the defaults for ``with context`` and ``without 576 context``. 577- The ``with`` and ``autoescape`` tags are now built-in. 578- Added the new ``select_autoescape`` function which helps configuring 579 better autoescaping easier. 580- Fixed a runtime error in the sandbox when attributes of async 581 generators were accessed. 582 583 584Version 2.8.1 585------------- 586 587Released 2016-12-29 588 589- Fixed the ``for_qs`` flag for ``urlencode``. 590- Fixed regression when applying ``int`` to non-string values. 591- SECURITY: if the sandbox mode is used format expressions are now 592 sandboxed with the same rules as in Jinja. This solves various 593 information leakage problems that can occur with format strings. 594 595 596Version 2.8 597----------- 598 599Released 2015-07-26, codename Replacement 600 601- Added ``target`` parameter to urlize function. 602- Added support for ``followsymlinks`` to the file system loader. 603- The truncate filter now counts the length. 604- Added equalto filter that helps with select filters. 605- Changed cache keys to use absolute file names if available instead 606 of load names. 607- Fixed loop length calculation for some iterators. 608- Changed how Jinja enforces strings to be native strings in Python 2 609 to work when people break their default encoding. 610- Added ``make_logging_undefined`` which returns an undefined 611 object that logs failures into a logger. 612- If unmarshalling of cached data fails the template will be reloaded 613 now. 614- Implemented a block ``set`` tag. 615- Default cache size was increased to 400 from a low 50. 616- Fixed ``is number`` test to accept long integers in all Python 617 versions. 618- Changed ``is number`` to accept Decimal as a number. 619- Added a check for default arguments followed by non-default 620 arguments. This change makes ``{% macro m(x, y=1, z) %}`` a syntax 621 error. The previous behavior for this code was broken anyway 622 (resulting in the default value being applied to ``y``). 623- Add ability to use custom subclasses of 624 ``jinja2.compiler.CodeGenerator`` and ``jinja2.runtime.Context`` by 625 adding two new attributes to the environment 626 (``code_generator_class`` and ``context_class``). :pr:`404` 627- Added support for context/environment/evalctx decorator functions on 628 the finalize callback of the environment. 629- Escape query strings for urlencode properly. Previously slashes were 630 not escaped in that place. 631- Add 'base' parameter to 'int' filter. 632 633 634Version 2.7.3 635------------- 636 637Released 2014-06-06 638 639- Security issue: Corrected the security fix for the cache folder. 640 This fix was provided by RedHat. 641 642 643Version 2.7.2 644------------- 645 646Released 2014-01-10 647 648- Prefix loader was not forwarding the locals properly to inner 649 loaders. This is now fixed. 650- Security issue: Changed the default folder for the filesystem cache 651 to be user specific and read and write protected on UNIX systems. 652 See `Debian bug 734747`_ for more information. 653 654.. _Debian bug 734747: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734747 655 656 657Version 2.7.1 658------------- 659 660Released 2013-08-07 661 662- Fixed a bug with ``call_filter`` not working properly on environment 663 and context filters. 664- Fixed lack of Python 3 support for bytecode caches. 665- Reverted support for defining blocks in included templates as this 666 broke existing templates for users. 667- Fixed some warnings with hashing of undefineds and nodes if Python 668 is run with warnings for Python 3. 669- Added support for properly hashing undefined objects. 670- Fixed a bug with the title filter not working on already uppercase 671 strings. 672 673 674Version 2.7 675----------- 676 677Released 2013-05-20, codename Translation 678 679- Choice and prefix loaders now dispatch source and template lookup 680 separately in order to work in combination with module loaders as 681 advertised. 682- Fixed filesizeformat. 683- Added a non-silent option for babel extraction. 684- Added ``urlencode`` filter that automatically quotes values for URL 685 safe usage with utf-8 as only supported encoding. If applications 686 want to change this encoding they can override the filter. 687- Added ``keep-trailing-newline`` configuration to environments and 688 templates to optionally preserve the final trailing newline. 689- Accessing ``last`` on the loop context no longer causes the iterator 690 to be consumed into a list. 691- Python requirement changed: 2.6, 2.7 or >= 3.3 are required now, 692 supported by same source code, using the "six" compatibility 693 library. 694- Allow ``contextfunction`` and other decorators to be applied to 695 ``__call__``. 696- Added support for changing from newline to different signs in the 697 ``wordwrap`` filter. 698- Added support for ignoring memcache errors silently. 699- Added support for keeping the trailing newline in templates. 700- Added finer grained support for stripping whitespace on the left 701 side of blocks. 702- Added ``map``, ``select``, ``reject``, ``selectattr`` and 703 ``rejectattr`` filters. 704- Added support for ``loop.depth`` to figure out how deep inside a 705 recursive loop the code is. 706- Disabled py_compile for pypy and python 3. 707 708 709Version 2.6 710----------- 711 712Released 2011-07-24, codename Convolution 713 714- Internal attributes now raise an internal attribute error now 715 instead of returning an undefined. This fixes problems when passing 716 undefined objects to Python semantics expecting APIs. 717- Traceback support now works properly for PyPy. (Tested with 1.4) 718- Implemented operator intercepting for sandboxed environments. This 719 allows application developers to disable builtin operators for 720 better security. (For instance limit the mathematical operators to 721 actual integers instead of longs) 722- Groupby filter now supports dotted notation for grouping by 723 attributes of attributes. 724- Scoped blocks now properly treat toplevel assignments and imports. 725 Previously an import suddenly "disappeared" in a scoped block. 726- Automatically detect newer Python interpreter versions before 727 loading code from bytecode caches to prevent segfaults on invalid 728 opcodes. The segfault in earlier Jinja versions here was not a 729 Jinja bug but a limitation in the underlying Python interpreter. If 730 you notice Jinja segfaulting in earlier versions after an upgrade 731 of the Python interpreter you don't have to upgrade, it's enough to 732 flush the bytecode cache. This just no longer makes this necessary, 733 Jinja will automatically detect these cases now. 734- The sum filter can now sum up values by attribute. This is a 735 backwards incompatible change. The argument to the filter previously 736 was the optional starting index which defaults to zero. This now 737 became the second argument to the function because it's rarely used. 738- Like sum, sort now also makes it possible to order items by 739 attribute. 740- Like sum and sort, join now also is able to join attributes of 741 objects as string. 742- The internal eval context now has a reference to the environment. 743- Added a mapping test to see if an object is a dict or an object with 744 a similar interface. 745 746 747Version 2.5.5 748------------- 749 750Released 2010-10-18 751 752- Built documentation is no longer part of release. 753 754 755Version 2.5.4 756------------- 757 758Released 2010-10-17 759 760- Fixed extensions not loading properly with overlays. 761- Work around a bug in cpython for the debugger that causes segfaults 762 on 64bit big-endian architectures. 763 764 765Version 2.5.3 766------------- 767 768Released 2010-10-17 769 770- Fixed an operator precedence error introduced in 2.5.2. Statements 771 like "-foo.bar" had their implicit parentheses applied around the 772 first part of the expression ("(-foo).bar") instead of the more 773 correct "-(foo.bar)". 774 775 776Version 2.5.2 777------------- 778 779Released 2010-08-18 780 781- Improved setup.py script to better work with assumptions people 782 might still have from it (``--with-speedups``). 783- Fixed a packaging error that excluded the new debug support. 784 785 786Version 2.5.1 787------------- 788 789Released 2010-08-17 790 791- StopIteration exceptions raised by functions called from templates 792 are now intercepted and converted to undefineds. This solves a lot 793 of debugging grief. (StopIteration is used internally to abort 794 template execution) 795- Improved performance of macro calls slightly. 796- Babel extraction can now properly extract newstyle gettext calls. 797- Using the variable ``num`` in newstyle gettext for something else 798 than the pluralize count will no longer raise a :exc:`KeyError`. 799- Removed builtin markup class and switched to markupsafe. For 800 backwards compatibility the pure Python implementation still exists 801 but is pulled from markupsafe by the Jinja developers. The debug 802 support went into a separate feature called "debugsupport" and is 803 disabled by default because it is only relevant for Python 2.4 804- Fixed an issue with unary operators having the wrong precedence. 805 806 807Version 2.5 808----------- 809 810Released 2010-05-29, codename Incoherence 811 812- Improved the sort filter (should have worked like this for a long 813 time) by adding support for case insensitive searches. 814- Fixed a bug for getattribute constant folding. 815- Support for newstyle gettext translations which result in a nicer 816 in-template user interface and more consistent catalogs. 817- It's now possible to register extensions after an environment was 818 created. 819 820 821Version 2.4.1 822------------- 823 824Released 2010-04-20 825 826- Fixed an error reporting bug for undefined. 827 828 829Version 2.4 830----------- 831 832Released 2010-04-13, codename Correlation 833 834- The environment template loading functions now transparently pass 835 through a template object if it was passed to it. This makes it 836 possible to import or extend from a template object that was passed 837 to the template. 838- Added a ``ModuleLoader`` that can load templates from 839 precompiled sources. The environment now features a method to 840 compile the templates from a configured loader into a zip file or 841 folder. 842- The _speedups C extension now supports Python 3. 843- Added support for autoescaping toggling sections and support for 844 evaluation contexts. 845- Extensions have a priority now. 846 847 848Version 2.3.1 849------------- 850 851Released 2010-02-19 852 853- Fixed an error reporting bug on all python versions 854- Fixed an error reporting bug on Python 2.4 855 856 857Version 2.3 858----------- 859 860Released 2010-02-10, codename 3000 Pythons 861 862- Fixes issue with code generator that causes unbound variables to be 863 generated if set was used in if-blocks and other small identifier 864 problems. 865- Include tags are now able to select between multiple templates and 866 take the first that exists, if a list of templates is given. 867- Fixed a problem with having call blocks in outer scopes that have an 868 argument that is also used as local variable in an inner frame 869 :issue:`360`. 870- Greatly improved error message reporting :pr:`339` 871- Implicit tuple expressions can no longer be totally empty. This 872 change makes ``{% if %}`` a syntax error now. :issue:`364` 873- Added support for translator comments if extracted via babel. 874- Added with-statement extension. 875- Experimental Python 3 support. 876 877 878Version 2.2.1 879------------- 880 881Released 2009-09-14 882 883- Fixes some smaller problems for Jinja on Jython. 884 885 886Version 2.2 887----------- 888 889Released 2009-09-13, codename Kong 890 891- Include statements can now be marked with ``ignore missing`` to skip 892 non existing templates. 893- Priority of ``not`` raised. It's now possible to write ``not foo in 894 bar`` as an alias to ``foo not in bar`` like in python. Previously 895 the grammar required parentheses (``not (foo in bar)``) which was 896 odd. 897- Fixed a bug that caused syntax errors when defining macros or using 898 the ``{% call %}`` tag inside loops. 899- Fixed a bug in the parser that made ``{{ foo[1, 2] }}`` impossible. 900- Made it possible to refer to names from outer scopes in included 901 templates that were unused in the callers frame :issue:`327` 902- Fixed a bug that caused internal errors if names where used as 903 iteration variable and regular variable *after* the loop if that 904 variable was unused *before* the loop. :pr:`331` 905- Added support for optional ``scoped`` modifier to blocks. 906- Added support for line-comments. 907- Added the ``meta`` module. 908- Renamed (undocumented) attribute "overlay" to "overlayed" on the 909 environment because it was clashing with a method of the same name. 910- Speedup extension is now disabled by default. 911 912 913Version 2.1.1 914------------- 915 916Released 2008-12-25 917 918- Fixed a translation error caused by looping over empty recursive 919 loops. 920 921 922Version 2.1 923----------- 924 925Released 2008-11-23, codename Yasuzō 926 927- Fixed a bug with nested loops and the special loop variable. Before 928 the change an inner loop overwrote the loop variable from the outer 929 one after iteration. 930- Fixed a bug with the i18n extension that caused the explicit 931 pluralization block to look up the wrong variable. 932- Fixed a limitation in the lexer that made ``{{ foo.0.0 }}`` 933 impossible. 934- Index based subscribing of variables with a constant value returns 935 an undefined object now instead of raising an index error. This was 936 a bug caused by eager optimizing. 937- The i18n extension looks up ``foo.ugettext`` now followed by 938 ``foo.gettext`` if an translations object is installed. This makes 939 dealing with custom translations classes easier. 940- Fixed a confusing behavior with conditional extending. loops were 941 partially executed under some conditions even though they were not 942 part of a visible area. 943- Added ``sort`` filter that works like ``dictsort`` but for arbitrary 944 sequences. 945- Fixed a bug with empty statements in macros. 946- Implemented a bytecode cache system. 947- The template context is now weakref-able 948- Inclusions and imports "with context" forward all variables now, not 949 only the initial context. 950- Added a cycle helper called ``cycler``. 951- Added a joining helper called ``joiner``. 952- Added a ``compile_expression`` method to the environment that allows 953 compiling of Jinja expressions into callable Python objects. 954- Fixed an escaping bug in urlize 955 956 957Version 2.0 958----------- 959 960Released 2008-07-17, codename Jinjavitus 961 962- The subscribing of objects (looking up attributes and items) changed 963 from slightly. It's now possible to give attributes or items a 964 higher priority by either using dot-notation lookup or the bracket 965 syntax. This also changed the AST slightly. ``Subscript`` is gone 966 and was replaced with ``Getitem`` and ``Getattr``. 967- Added support for preprocessing and token stream filtering for 968 extensions. This would allow extensions to allow simplified gettext 969 calls in template data and something similar. 970- Added ``TemplateStream.dump``. 971- Added missing support for implicit string literal concatenation. 972 ``{{ "foo" "bar" }}`` is equivalent to ``{{ "foobar" }}`` 973- ``else`` is optional for conditional expressions. If not given it 974 evaluates to ``false``. 975- Improved error reporting for undefined values by providing a 976 position. 977- ``filesizeformat`` filter uses decimal prefixes now per default and 978 can be set to binary mode with the second parameter. 979- Fixed bug in finalizer 980 981 982Version 2.0rc1 983-------------- 984 985Released 2008-06-09 986 987- First release of Jinja 2. 988