Skip to content
Myr

clean up MANIFEST.in

Before adoption: this commit came in with the history the project adopted, so no landing records it.

clean up make-release.py for py3 add rst extension to CHANGES for GitHub clean up changelog formatting

authored by David Lord · committed by David Lord · parent 072cdf9 · Browse files · 5 files+651 added−613 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+651 added−613 removed

  • other:+651 added−613 removed

5 files+651 added−613 removed

modified:docs/changelog.rst+1 added-1 removed
1.. module:: jinja223.. include:: ../CHANGES3.. include:: ../CHANGES.rst
modified:scripts/make-release.py+46 added-30 removed
8 unmodified lines
910 :copyright: (c) 2011 by Armin Ronacher.11 :license: BSD, see LICENSE for more details.12"""13import sys13from __future__ import print_function1415import os16import re17import sys16from datetime import datetime, date17from subprocess import Popen, PIPE18from datetime import date, datetime19from subprocess import PIPE, Popen2019try:20 import wheel21except ImportError:22 wheel = None2321_date_strip_re = re.compile(r'(?<=\d)(st|nd|rd|th)')222324def parse_changelog():28 with open('CHANGES') as f:25 with open('CHANGES.rst') as f:26 lineiter = iter(f)27 for line in lineiter:28 match = re.search('^Version\s+(.*)', line.strip())2930 if match is None:31 continue34 length = len(match.group(1))3233 version = match.group(1).strip()3436 if lineiter.next().count('-') != len(match.group(0)):35 if next(lineiter).count('-') != len(match.group(0)):36 continue3738 while 1:39 change_info = lineiter.next().strip()39 change_info = next(lineiter).strip()4041 if change_info:42 break4343 match = re.search(r'(?:codename (.*),\s*)?'44 r'released on (\w+\s+\d+\w+\s+\d+)(?i)',45 change_info)44 match = re.search(45 r'(?:codename (.*),\s*)?released on (\w+\s+\d+\w+\s+\d+)(?i)',46 change_info47 )4849 if match is None:50 continue5152 codename, datestr = match.groups()
1 unmodified line
545556def bump_version(version):57 try:55 parts = map(int, version.split('.'))58 parts = [int(i) for i in version.split('.')]59 except ValueError:60 fail('Current version is not numeric')6162 parts[-1] += 163 return '.'.join(map(str, parts))6465
3 unmodified lines
697071def set_filename_version(filename, version_number, pattern):72 changed = []7374 def inject_version(match):75 before, old, after = match.groups()76 changed.append(True)77 return before + version_number + after7879 with open(filename) as f:80 contents = re.sub(74 contents = re.sub(r"^(\s*%s\s*=\s*')(.+?)(')(?sm)" % pattern,75 inject_version, f.read())81 r"^(\s*%s\s*=\s*')(.+?)(')(?sm)" % pattern,82 inject_version, f.read()83 )8485 if not changed:86 fail('Could not find %s in %s', pattern, filename)87
11 unmodified lines
99 set_filename_version('setup.py', version, 'version')100101102def build_and_upload():95 cmd = [sys.executable, 'setup.py', 'sdist', 'bdist_wheel', 'upload']96 if wheel is not None:97 cmd.insert(4, 'bdist_wheel')103 cmd = [sys.executable, 'setup.py', 'sdist', 'bdist_wheel']104 Popen(cmd).wait()105106107def fail(message, *args):102 print >> sys.stderr, 'Error:', message % args108 print('Error:', message % args, file=sys.stderr)109 sys.exit(1)110111112def info(message, *args):107 print >> sys.stderr, message % args113 print(message % args, file=sys.stderr)114115116def get_git_tags():111 return set(Popen(['git', 'tag'], stdout=PIPE).communicate()[0].splitlines())117 return set(118 Popen(['git', 'tag'], stdout=PIPE).communicate()[0].splitlines()119 )120121122def git_is_clean():123 return Popen(['git', 'diff', '--quiet']).wait() == 0
12 unmodified lines
136def main():137 os.chdir(os.path.join(os.path.dirname(__file__), '..'))138139 rv = parse_changelog()140141 if rv is None:142 fail('Could not parse changelog')143144 version, release_date, codename = rv145 dev_version = bump_version(version) + '.dev'146147 info(138 info('Releasing %s (codename %s, release date %s)',139 version, codename, release_date.strftime('%d/%m/%Y'))148 'Releasing %s (codename %s, release date %s)',149 version, codename, release_date.strftime('%d/%m/%Y')150 )151 tags = get_git_tags()152153 if version in tags:154 fail('Version "%s" is already tagged', version)155156 if release_date.date() != date.today():145 fail('Release date is not today (%s != %s)', release_date.date(), date.today())157 fail(158 'Release date is not today (%s != %s)',159 release_date.date(), date.today()160 )161162 if not git_is_clean():163 fail('You have uncommitted changes in git')164150 if wheel is None:151 print ('Warning: You need to install the wheel package '152 'to upload a wheel distribution.')165 try:166 import wheel167 except ImportError:168 fail('You need to install the wheel package.')169170 set_init_version(version)171 set_setup_version(version)172 make_git_commit('Bump version number to %s', version)
8 unmodified lines
deleted:CHANGES-570 removed
1Jinja2 Changelog2================34Version 2.105------------6(feature release, release date to be decided)78- Added a new extension node called `OverlayScope` which can be used to9 create an unoptimized scope that will look up all variables from a10 derived context.11- Added an `in` test that works like the in operator. This can be used12 in combination with `reject` and `select`.13- Added `previtem` and `nextitem` to loop contexts, providing access to the14 previous/next item in the loop. If such an item does not exist, the value is15 undefined.16- Added `changed(*values)` to loop contexts, providing an easy way of checking17 whether a value has changed since the last iteration (or rather since the18 last call of the method)19- Added a `namespace` function that creates a special object which allows20 attribute assignment using the `set` tag. This can be used to carry data21 across scopes, e.g. from a loop body to code that comes after the loop.22- Added a `trimmed` modifier to `{% trans %}` to strip linebreaks and23 surrounding whitespace. Also added a new policy to enable this for all24 `trans` blocks.25- The ``random`` filter is no longer incorrectly constant folded and will26 produce a new random choice each time the template is rendered. (`#478`_)27- Added a ``unique`` filter. (`#469`_)28- Added ``min`` and ``max`` filters. (`#475`_)29- Added tests for all comparison operators: ``eq``, ``ne``, ``lt``, ``le``,30 ``gt``, ``ge``. (`#665`_)31- ``import`` statement cannot end with a trailing comma. (`#617`_, `#618`_)32- ``indent`` filter will not indent blank lines by default. (`#685`_)33- Add ``reverse`` argument for ``dictsort`` filter. (`#692`_)34- Add a ``NativeEnvironment`` that renders templates to native Python types35 instead of strings. (`#708`_)36- Added filter support to the block ``set`` tag. (`#489`_)3738.. _#469: https://github.com/pallets/jinja/pull/46939.. _#475: https://github.com/pallets/jinja/pull/47540.. _#478: https://github.com/pallets/jinja/pull/47841.. _#489: https://github.com/pallets/jinja/pull/48942.. _#617: https://github.com/pallets/jinja/pull/61743.. _#618: https://github.com/pallets/jinja/pull/61844.. _#665: https://github.com/pallets/jinja/pull/66545.. _#685: https://github.com/pallets/jinja/pull/68546.. _#692: https://github.com/pallets/jinja/pull/69247.. _#708: https://github.com/pallets/jinja/pull/7084849Version 2.9.750-------------5152(bugfix release, in development)5354- ``tojson`` filter marks output as safe to match documented behavior.55 (`#718`_)56- Resolved a bug where getting debug locals for tracebacks could57 modify template context.58- Fixed a bug where having many `{% elif ... %}` blocks resulted in a59 "too many levels of indentation" error. These blocks now compile to60 native `elif ..:` instead of `else: if ..:` (#759)6162.. _#718: https://github.com/pallets/jinja/pull/7186364Version 2.9.665-------------66(bugfix release, released on April 3rd 2017)6768- Fixed custom context behavior in fast resolve mode (#675)6970Version 2.9.571-------------72(bugfix release, released on January 28th 2017)7374- Restored the original repr of the internal `_GroupTuple` because this75 caused issues with ansible and it was an unintended change. (#654)76- Added back support for custom contexts that override the old `resolve`77 method since it was hard for people to spot that this could cause a78 regression.79- Correctly use the buffer for the else block of for loops. This caused80 invalid syntax errors to be caused on 2.x and completely wrong behavior81 on Python 3 (#669)82- Resolve an issue where the `{% extends %}` tag could not be used with83 async environments. (#668)84- Reduce memory footprint slightly by reducing our unicode database dump85 we use for identifier matching on Python 3 (#666)86- Fixed autoescaping not working for macros in async compilation mode. (#671)8788Version 2.9.489-------------90(bugfix release, released on January 10th 2017)9192- Solved some warnings for string literals. (#646)93- Increment the bytecode cache version which was not done due to an94 oversight before.95- Corrected bad code generation and scoping for filtered loops. (#649)96- Resolved an issue where top-level output silencing after known extend97 blocks could generate invalid code when blocks where contained in if98 statements. (#651)99- Made the `truncate.leeway` default configurable to improve compatibility100 with older templates.101102Version 2.9.3103-------------104(bugfix release, released on January 8th 2017)105106- Restored the use of blocks in macros to the extend that was possible107 before. On Python 3 it would render a generator repr instead of108 the block contents. (#645)109- Set a consistent behavior for assigning of variables in inner scopes110 when the variable is also read from an outer scope. This now sets the111 intended behavior in all situations however it does not restore the112 old behavior where limited assignments to outer scopes was possible.113 For more information and a discussion see #641114- Resolved an issue where `block scoped` would not take advantage of the115 new scoping rules. In some more exotic cases a variable overriden in a116 local scope would not make it into a block.117- Change the code generation of the `with` statement to be in line with the118 new scoping rules. This resolves some unlikely bugs in edge cases. This119 also introduces a new internal `With` node that can be used by extensions.120121Version 2.9.2122-------------123(bugfix release, released on January 8th 2017)124125- Fixed a regression that caused for loops to not be able to use the same126 variable for the target as well as source iterator. (#640)127- Add support for a previously unknown behavior of macros. It used to be128 possible in some circumstances to explicitly provide a caller argument129 to macros. While badly buggy and unintended it turns out that this is a130 common case that gets copy pasted around. To not completely break backwards131 compatibility with the most common cases it's now possible to provide an132 explicit keyword argument for caller if it's given an explicit default.133 (#642)134135Version 2.9.1136-------------137(bugfix release, released on January 7th 2017)138139- Resolved a regression with call block scoping for macros. Nested caller140 blocks that used the same identifiers as outer macros could refer to the141 wrong variable incorrectly.142143Version 2.9144-----------145(codename Derivation, released on January 7th 2017)146147- Change cache key definition in environment. This fixes a performance148 regression introduced in 2.8.149- Added support for `generator_stop` on supported Python versions150 (Python 3.5 and later)151- Corrected a long standing issue with operator precedence of math operations152 not being what was expected.153- Added support for Python 3.6 async iterators through a new async mode.154- Added policies for filter defaults and similar things.155- urlize now sets "rel noopener" by default.156- Support attribute fallback for old-style classes in 2.x.157- Support toplevel set statements in extend situations.158- Restored behavior of Cycler for Python 3 users.159- Subtraction now follows the same behavior as other operators on undefined160 values.161- `map` and friends will now give better error messages if you forgot to162 quote the parameter.163- Depend on MarkupSafe 0.23 or higher.164- Improved the `truncate` filter to support better truncation in case165 the string is barely truncated at all.166- Change the logic for macro autoescaping to be based on the runtime167 autoescaping information at call time instead of macro define time.168- Ported a modified version of the `tojson` filter from Flask to Jinja2169 and hooked it up with the new policy framework.170- Block sets are now marked `safe` by default.171- On Python 2 the asciification of ASCII strings can now be disabled with172 the `compiler.ascii_str` policy.173- Tests now no longer accept an arbitrary expression as first argument but174 a restricted one. This means that you can now properly use multiple175 tests in one expression without extra parentheses. In particular you can176 now write ``foo is divisibleby 2 or foo is divisibleby 3``177 as you would expect.178- Greatly changed the scoping system to be more consistent with what template179 designers and developers expect. There is now no more magic difference180 between the different include and import constructs. Context is now always181 propagated the same way. The only remaining differences is the defaults182 for `with context` and `without context`.183- The `with` and `autoescape` tags are now built-in.184- Added the new `select_autoescape` function which helps configuring better185 autoescaping easier.186187Version 2.8.2188-------------189190(bugfix release, unreleased)191192- Fixed a runtime error in the sandbox when attributes of async generators193 were accessed.194195Version 2.8.1196-------------197198(bugfix release, released on December 29th 2016)199200- Fixed the `for_qs` flag for `urlencode`.201- Fixed regression when applying `int` to non-string values.202- SECURITY: if the sandbox mode is used format expressions are now sandboxed203 with the same rules as in Jinja. This solves various information leakage204 problems that can occur with format strings.205206Version 2.8207-----------208(codename Replacement, released on July 26th 2015)209210- Added `target` parameter to urlize function.211- Added support for `followsymlinks` to the file system loader.212- The truncate filter now counts the length.213- Added equalto filter that helps with select filters.214- Changed cache keys to use absolute file names if available215 instead of load names.216- Fixed loop length calculation for some iterators.217- Changed how Jinja2 enforces strings to be native strings in218 Python 2 to work when people break their default encoding.219- Added :func:`make_logging_undefined` which returns an undefined220 object that logs failures into a logger.221- If unmarshalling of cached data fails the template will be222 reloaded now.223- Implemented a block ``set`` tag.224- Default cache size was increased to 400 from a low 50.225- Fixed ``is number`` test to accept long integers in all Python versions.226- Changed ``is number`` to accept Decimal as a number.227- Added a check for default arguments followed by non-default arguments. This228 change makes ``{% macro m(x, y=1, z) %}...{% endmacro %}`` a syntax error. The229 previous behavior for this code was broken anyway (resulting in the default230 value being applied to `y`).231- Add ability to use custom subclasses of ``jinja2.compiler.CodeGenerator`` and232 ``jinja2.runtime.Context`` by adding two new attributes to the environment233 (`code_generator_class` and `context_class`) (pull request ``#404``).234- added support for context/environment/evalctx decorator functions on235 the finalize callback of the environment.236- escape query strings for urlencode properly. Previously slashes were not237 escaped in that place.238- Add 'base' parameter to 'int' filter.239240Version 2.7.3241-------------242(bugfix release, released on June 6th 2014)243244- Security issue: Corrected the security fix for the cache folder. This245 fix was provided by RedHat.246247Version 2.7.2248-------------249(bugfix release, released on January 10th 2014)250251- Prefix loader was not forwarding the locals properly to252 inner loaders. This is now fixed.253- Security issue: Changed the default folder for the filesystem cache to be254 user specific and read and write protected on UNIX systems. See `Debian bug255 734747`_ for more information.256257.. _Debian bug 734747: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734747258259Version 2.7.1260-------------261(bugfix release, released on August 7th 2013)262263- Fixed a bug with ``call_filter`` not working properly on environment264 and context filters.265- Fixed lack of Python 3 support for bytecode caches.266- Reverted support for defining blocks in included templates as this267 broke existing templates for users.268- Fixed some warnings with hashing of undefineds and nodes if Python269 is run with warnings for Python 3.270- Added support for properly hashing undefined objects.271- Fixed a bug with the title filter not working on already uppercase272 strings.273274Version 2.7275-----------276(codename Translation, released on May 20th 2013)277278- Choice and prefix loaders now dispatch source and template lookup279 separately in order to work in combination with module loaders as280 advertised.281- Fixed filesizeformat.282- Added a non-silent option for babel extraction.283- Added `urlencode` filter that automatically quotes values for284 URL safe usage with utf-8 as only supported encoding. If applications285 want to change this encoding they can override the filter.286- Added `keep-trailing-newline` configuration to environments and287 templates to optionally preserve the final trailing newline.288- Accessing `last` on the loop context no longer causes the iterator289 to be consumed into a list.290- Python requirement changed: 2.6, 2.7 or >= 3.3 are required now,291 supported by same source code, using the "six" compatibility library.292- Allow `contextfunction` and other decorators to be applied to `__call__`.293- Added support for changing from newline to different signs in the `wordwrap`294 filter.295- Added support for ignoring memcache errors silently.296- Added support for keeping the trailing newline in templates.297- Added finer grained support for stripping whitespace on the left side298 of blocks.299- Added `map`, `select`, `reject`, `selectattr` and `rejectattr`300 filters.301- Added support for `loop.depth` to figure out how deep inside a recursive302 loop the code is.303- Disabled py_compile for pypy and python 3.304305Version 2.6306-----------307(codename Convolution, released on July 24th 2011)308309- internal attributes now raise an internal attribute error now instead310 of returning an undefined. This fixes problems when passing undefined311 objects to Python semantics expecting APIs.312- traceback support now works properly for PyPy. (Tested with 1.4)313- implemented operator intercepting for sandboxed environments. This314 allows application developers to disable builtin operators for better315 security. (For instance limit the mathematical operators to actual316 integers instead of longs)317- groupby filter now supports dotted notation for grouping by attributes318 of attributes.319- scoped blocks now properly treat toplevel assignments and imports.320 Previously an import suddenly "disappeared" in a scoped block.321- automatically detect newer Python interpreter versions before loading code322 from bytecode caches to prevent segfaults on invalid opcodes. The segfault323 in earlier Jinja2 versions here was not a Jinja2 bug but a limitation in324 the underlying Python interpreter. If you notice Jinja2 segfaulting in325 earlier versions after an upgrade of the Python interpreter you don't have326 to upgrade, it's enough to flush the bytecode cache. This just no longer327 makes this necessary, Jinja2 will automatically detect these cases now.328- the sum filter can now sum up values by attribute. This is a backwards329 incompatible change. The argument to the filter previously was the330 optional starting index which defaults to zero. This now became the331 second argument to the function because it's rarely used.332- like sum, sort now also makes it possible to order items by attribute.333- like sum and sort, join now also is able to join attributes of objects334 as string.335- the internal eval context now has a reference to the environment.336- added a mapping test to see if an object is a dict or an object with337 a similar interface.338339Version 2.5.5340-------------341(re-release of 2.5.4 with built documentation removed for filesize.342 Released on October 18th 2010)343344- built documentation is no longer part of release.345346Version 2.5.4347-------------348(bugfix release, released on October 17th 2010)349350- Fixed extensions not loading properly with overlays.351- Work around a bug in cpython for the debugger that causes segfaults352 on 64bit big-endian architectures.353354Version 2.5.3355-------------356(bugfix release, released on October 17th 2010)357358- fixed an operator precedence error introduced in 2.5.2. Statements359 like "-foo.bar" had their implicit parentheses applied around the360 first part of the expression ("(-foo).bar") instead of the more361 correct "-(foo.bar)".362363Version 2.5.2364-------------365(bugfix release, released on August 18th 2010)366367- improved setup.py script to better work with assumptions people368 might still have from it (``--with-speedups``).369- fixed a packaging error that excluded the new debug support.370371Version 2.5.1372-------------373(bugfix release, released on August 17th 2010)374375- StopIteration exceptions raised by functions called from templates376 are now intercepted and converted to undefineds. This solves a377 lot of debugging grief. (StopIteration is used internally to378 abort template execution)379- improved performance of macro calls slightly.380- babel extraction can now properly extract newstyle gettext calls.381- using the variable `num` in newstyle gettext for something else382 than the pluralize count will no longer raise a :exc:`KeyError`.383- removed builtin markup class and switched to markupsafe. For backwards384 compatibility the pure Python implementation still exists but is385 pulled from markupsafe by the Jinja2 developers. The debug support386 went into a separate feature called "debugsupport" and is disabled387 by default because it is only relevant for Python 2.4388- fixed an issue with unary operators having the wrong precedence.389390Version 2.5391-----------392(codename Incoherence, released on May 29th 2010)393394- improved the sort filter (should have worked like this for a395 long time) by adding support for case insensitive searches.396- fixed a bug for getattribute constant folding.397- support for newstyle gettext translations which result in a398 nicer in-template user interface and more consistent399 catalogs. (:ref:`newstyle-gettext`)400- it's now possible to register extensions after an environment401 was created.402403Version 2.4.1404-------------405(bugfix release, released on April 20th 2010)406407- fixed an error reporting bug for undefineds.408409Version 2.4410-----------411(codename Correlation, released on April 13th 2010)412413- the environment template loading functions now transparently414 pass through a template object if it was passed to it. This415 makes it possible to import or extend from a template object416 that was passed to the template.417- added a :class:`ModuleLoader` that can load templates from418 precompiled sources. The environment now features a method419 to compile the templates from a configured loader into a zip420 file or folder.421- the _speedups C extension now supports Python 3.422- added support for autoescaping toggling sections and support423 for evaluation contexts (:ref:`eval-context`).424- extensions have a priority now.425426Version 2.3.1427-------------428(bugfix release, released on February 19th 2010)429430- fixed an error reporting bug on all python versions431- fixed an error reporting bug on Python 2.4432433Version 2.3434-----------435(3000 Pythons, released on February 10th 2010)436437- fixes issue with code generator that causes unbound variables438 to be generated if set was used in if-blocks and other small439 identifier problems.440- include tags are now able to select between multiple templates441 and take the first that exists, if a list of templates is442 given.443- fixed a problem with having call blocks in outer scopes that444 have an argument that is also used as local variable in an445 inner frame (#360).446- greatly improved error message reporting (#339)447- implicit tuple expressions can no longer be totally empty.448 This change makes ``{% if %}...{% endif %}`` a syntax error449 now. (#364)450- added support for translator comments if extracted via babel.451- added with-statement extension.452- experimental Python 3 support.453454Version 2.2.1455-------------456(bugfix release, released on September 14th 2009)457458- fixes some smaller problems for Jinja2 on Jython.459460Version 2.2461-----------462(codename Kong, released on September 13th 2009)463464- Include statements can now be marked with ``ignore missing`` to skip465 non existing templates.466- Priority of `not` raised. It's now possible to write `not foo in bar`467 as an alias to `foo not in bar` like in python. Previously the grammar468 required parentheses (`not (foo in bar)`) which was odd.469- Fixed a bug that caused syntax errors when defining macros or using the470 `{% call %}` tag inside loops.471- Fixed a bug in the parser that made ``{{ foo[1, 2] }}`` impossible.472- Made it possible to refer to names from outer scopes in included templates473 that were unused in the callers frame (#327)474- Fixed a bug that caused internal errors if names where used as iteration475 variable and regular variable *after* the loop if that variable was unused476 *before* the loop. (#331)477- Added support for optional `scoped` modifier to blocks.478- Added support for line-comments.479- Added the `meta` module.480- Renamed (undocumented) attribute "overlay" to "overlayed" on the481 environment because it was clashing with a method of the same name.482- speedup extension is now disabled by default.483484Version 2.1.1485-------------486(Bugfix release)487488- Fixed a translation error caused by looping over empty recursive loops.489490Version 2.1491-----------492(codename Yasuzō, released on November 23rd 2008)493494- fixed a bug with nested loops and the special loop variable. Before the495 change an inner loop overwrote the loop variable from the outer one after496 iteration.497498- fixed a bug with the i18n extension that caused the explicit pluralization499 block to look up the wrong variable.500501- fixed a limitation in the lexer that made ``{{ foo.0.0 }}`` impossible.502503- index based subscribing of variables with a constant value returns an504 undefined object now instead of raising an index error. This was a bug505 caused by eager optimizing.506507- the i18n extension looks up `foo.ugettext` now followed by `foo.gettext`508 if an translations object is installed. This makes dealing with custom509 translations classes easier.510511- fixed a confusing behavior with conditional extending. loops were partially512 executed under some conditions even though they were not part of a visible513 area.514515- added `sort` filter that works like `dictsort` but for arbitrary sequences.516517- fixed a bug with empty statements in macros.518519- implemented a bytecode cache system. (:ref:`bytecode-cache`)520521- the template context is now weakref-able522523- inclusions and imports "with context" forward all variables now, not only524 the initial context.525526- added a cycle helper called `cycler`.527528- added a joining helper called `joiner`.529530- added a `compile_expression` method to the environment that allows compiling531 of Jinja expressions into callable Python objects.532533- fixed an escaping bug in urlize534535Version 2.0536-----------537(codename jinjavitus, released on July 17th 2008)538539- the subscribing of objects (looking up attributes and items) changed from540 slightly. It's now possible to give attributes or items a higher priority541 by either using dot-notation lookup or the bracket syntax. This also542 changed the AST slightly. `Subscript` is gone and was replaced with543 :class:`~jinja2.nodes.Getitem` and :class:`~jinja2.nodes.Getattr`.544545 For more information see :ref:`the implementation details <notes-on-subscriptions>`.546547- added support for preprocessing and token stream filtering for extensions.548 This would allow extensions to allow simplified gettext calls in template549 data and something similar.550551- added :meth:`jinja2.environment.TemplateStream.dump`.552553- added missing support for implicit string literal concatenation.554 ``{{ "foo" "bar" }}`` is equivalent to ``{{ "foobar" }}``555556- `else` is optional for conditional expressions. If not given it evaluates557 to `false`.558559- improved error reporting for undefined values by providing a position.560561- `filesizeformat` filter uses decimal prefixes now per default and can be562 set to binary mode with the second parameter.563564- fixed bug in finalizer565566Version 2.0rc1567--------------568(no codename, released on June 9th 2008)569570- first release of Jinja2
added:CHANGES.rst+596 added
1Jinja Changelog2===============345Version 2.106------------78released on November 8th 2017910- Added a new extension node called ``OverlayScope`` which can be used to11 create an unoptimized scope that will look up all variables from a12 derived context.13- Added an ``in`` test that works like the in operator. This can be used14 in combination with ``reject`` and ``select``.15- Added ``previtem`` and ``nextitem`` to loop contexts, providing access to the16 previous/next item in the loop. If such an item does not exist, the value is17 undefined.18- Added ``changed(*values)`` to loop contexts, providing an easy way of19 checking whether a value has changed since the last iteration (or rather20 since the last call of the method)21- Added a ``namespace`` function that creates a special object which allows22 attribute assignment using the ``set`` tag. This can be used to carry data23 across scopes, e.g. from a loop body to code that comes after the loop.24- Added a ``trimmed`` modifier to ``{% trans %}`` to strip linebreaks and25 surrounding whitespace. Also added a new policy to enable this for all26 ``trans`` blocks.27- The ``random`` filter is no longer incorrectly constant folded and will28 produce a new random choice each time the template is rendered. (`#478`_)29- Added a ``unique`` filter. (`#469`_)30- Added ``min`` and ``max`` filters. (`#475`_)31- Added tests for all comparison operators: ``eq``, ``ne``, ``lt``, ``le``,32 ``gt``, ``ge``. (`#665`_)33- ``import`` statement cannot end with a trailing comma. (`#617`_, `#618`_)34- ``indent`` filter will not indent blank lines by default. (`#685`_)35- Add ``reverse`` argument for ``dictsort`` filter. (`#692`_)36- Add a ``NativeEnvironment`` that renders templates to native Python types37 instead of strings. (`#708`_)38- Added filter support to the block ``set`` tag. (`#489`_)39- ``tojson`` filter marks output as safe to match documented behavior.40 (`#718`_)41- Resolved a bug where getting debug locals for tracebacks could42 modify template context.43- Fixed a bug where having many ``{% elif ... %}`` blocks resulted in a44 "too many levels of indentation" error. These blocks now compile to45 native ``elif ..:`` instead of ``else: if ..:`` (`#759`_)4647.. _#469: https://github.com/pallets/jinja/pull/46948.. _#475: https://github.com/pallets/jinja/pull/47549.. _#478: https://github.com/pallets/jinja/pull/47850.. _#489: https://github.com/pallets/jinja/pull/48951.. _#617: https://github.com/pallets/jinja/pull/61752.. _#618: https://github.com/pallets/jinja/pull/61853.. _#665: https://github.com/pallets/jinja/pull/66554.. _#685: https://github.com/pallets/jinja/pull/68555.. _#692: https://github.com/pallets/jinja/pull/69256.. _#708: https://github.com/pallets/jinja/pull/70857.. _#718: https://github.com/pallets/jinja/pull/71858.. _#759: https://github.com/pallets/jinja/pull/759596061Version 2.9.662-------------6364(bugfix release, released on April 3rd 2017)6566- Fixed custom context behavior in fast resolve mode (#675)676869Version 2.9.570-------------7172(bugfix release, released on January 28th 2017)7374- Restored the original repr of the internal ``_GroupTuple`` because this75 caused issues with ansible and it was an unintended change. (#654)76- Added back support for custom contexts that override the old ``resolve``77 method since it was hard for people to spot that this could cause a78 regression.79- Correctly use the buffer for the else block of for loops. This caused80 invalid syntax errors to be caused on 2.x and completely wrong behavior81 on Python 3 (#669)82- Resolve an issue where the ``{% extends %}`` tag could not be used with83 async environments. (#668)84- Reduce memory footprint slightly by reducing our unicode database dump85 we use for identifier matching on Python 3 (#666)86- Fixed autoescaping not working for macros in async compilation mode. (#671)878889Version 2.9.490-------------9192(bugfix release, released on January 10th 2017)9394- Solved some warnings for string literals. (#646)95- Increment the bytecode cache version which was not done due to an96 oversight before.97- Corrected bad code generation and scoping for filtered loops. (#649)98- Resolved an issue where top-level output silencing after known extend99 blocks could generate invalid code when blocks where contained in if100 statements. (#651)101- Made the ``truncate.leeway`` default configurable to improve compatibility102 with older templates.103104105Version 2.9.3106-------------107108(bugfix release, released on January 8th 2017)109110- Restored the use of blocks in macros to the extend that was possible111 before. On Python 3 it would render a generator repr instead of112 the block contents. (#645)113- Set a consistent behavior for assigning of variables in inner scopes114 when the variable is also read from an outer scope. This now sets the115 intended behavior in all situations however it does not restore the116 old behavior where limited assignments to outer scopes was possible.117 For more information and a discussion see #641118- Resolved an issue where ``block scoped`` would not take advantage of the119 new scoping rules. In some more exotic cases a variable overriden in a120 local scope would not make it into a block.121- Change the code generation of the ``with`` statement to be in line with the122 new scoping rules. This resolves some unlikely bugs in edge cases. This123 also introduces a new internal ``With`` node that can be used by extensions.124125126Version 2.9.2127-------------128129(bugfix release, released on January 8th 2017)130131- Fixed a regression that caused for loops to not be able to use the same132 variable for the target as well as source iterator. (#640)133- Add support for a previously unknown behavior of macros. It used to be134 possible in some circumstances to explicitly provide a caller argument135 to macros. While badly buggy and unintended it turns out that this is a136 common case that gets copy pasted around. To not completely break backwards137 compatibility with the most common cases it's now possible to provide an138 explicit keyword argument for caller if it's given an explicit default.139 (#642)140141142Version 2.9.1143-------------144145(bugfix release, released on January 7th 2017)146147- Resolved a regression with call block scoping for macros. Nested caller148 blocks that used the same identifiers as outer macros could refer to the149 wrong variable incorrectly.150151152Version 2.9153-----------154(codename Derivation, released on January 7th 2017)155156- Change cache key definition in environment. This fixes a performance157 regression introduced in 2.8.158- Added support for ``generator_stop`` on supported Python versions159 (Python 3.5 and later)160- Corrected a long standing issue with operator precedence of math operations161 not being what was expected.162- Added support for Python 3.6 async iterators through a new async mode.163- Added policies for filter defaults and similar things.164- urlize now sets "rel noopener" by default.165- Support attribute fallback for old-style classes in 2.x.166- Support toplevel set statements in extend situations.167- Restored behavior of Cycler for Python 3 users.168- Subtraction now follows the same behavior as other operators on undefined169 values.170- ``map`` and friends will now give better error messages if you forgot to171 quote the parameter.172- Depend on MarkupSafe 0.23 or higher.173- Improved the ``truncate`` filter to support better truncation in case174 the string is barely truncated at all.175- Change the logic for macro autoescaping to be based on the runtime176 autoescaping information at call time instead of macro define time.177- Ported a modified version of the ``tojson`` filter from Flask to Jinja2178 and hooked it up with the new policy framework.179- Block sets are now marked ``safe`` by default.180- On Python 2 the asciification of ASCII strings can now be disabled with181 the ``compiler.ascii_str`` policy.182- Tests now no longer accept an arbitrary expression as first argument but183 a restricted one. This means that you can now properly use multiple184 tests in one expression without extra parentheses. In particular you can185 now write ``foo is divisibleby 2 or foo is divisibleby 3``186 as you would expect.187- Greatly changed the scoping system to be more consistent with what template188 designers and developers expect. There is now no more magic difference189 between the different include and import constructs. Context is now always190 propagated the same way. The only remaining differences is the defaults191 for ``with context`` and ``without context``.192- The ``with`` and ``autoescape`` tags are now built-in.193- Added the new ``select_autoescape`` function which helps configuring better194 autoescaping easier.195- Fixed a runtime error in the sandbox when attributes of async generators196 were accessed.197198199Version 2.8.1200-------------201202(bugfix release, released on December 29th 2016)203204- Fixed the ``for_qs`` flag for ``urlencode``.205- Fixed regression when applying ``int`` to non-string values.206- SECURITY: if the sandbox mode is used format expressions are now sandboxed207 with the same rules as in Jinja. This solves various information leakage208 problems that can occur with format strings.209210211Version 2.8212-----------213214(codename Replacement, released on July 26th 2015)215216- Added ``target`` parameter to urlize function.217- Added support for ``followsymlinks`` to the file system loader.218- The truncate filter now counts the length.219- Added equalto filter that helps with select filters.220- Changed cache keys to use absolute file names if available221 instead of load names.222- Fixed loop length calculation for some iterators.223- Changed how Jinja2 enforces strings to be native strings in224 Python 2 to work when people break their default encoding.225- Added :func:`make_logging_undefined` which returns an undefined226 object that logs failures into a logger.227- If unmarshalling of cached data fails the template will be228 reloaded now.229- Implemented a block ``set`` tag.230- Default cache size was increased to 400 from a low 50.231- Fixed ``is number`` test to accept long integers in all Python versions.232- Changed ``is number`` to accept Decimal as a number.233- Added a check for default arguments followed by non-default arguments. This234 change makes ``{% macro m(x, y=1, z) %}...{% endmacro %}`` a syntax error.235 The previous behavior for this code was broken anyway (resulting in the236 default value being applied to ``y``).237- Add ability to use custom subclasses of ``jinja2.compiler.CodeGenerator`` and238 ``jinja2.runtime.Context`` by adding two new attributes to the environment239 (``code_generator_class`` and ``context_class``) (pull request ``#404``).240- added support for context/environment/evalctx decorator functions on241 the finalize callback of the environment.242- escape query strings for urlencode properly. Previously slashes were not243 escaped in that place.244- Add 'base' parameter to 'int' filter.245246247Version 2.7.3248-------------249250(bugfix release, released on June 6th 2014)251252- Security issue: Corrected the security fix for the cache folder. This253 fix was provided by RedHat.254255256Version 2.7.2257-------------258259(bugfix release, released on January 10th 2014)260261- Prefix loader was not forwarding the locals properly to262 inner loaders. This is now fixed.263- Security issue: Changed the default folder for the filesystem cache to be264 user specific and read and write protected on UNIX systems. See265 `Debian bug 734747`_ for more information.266267.. _Debian bug 734747: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734747268269270Version 2.7.1271-------------272273(bugfix release, released on August 7th 2013)274275- Fixed a bug with ``call_filter`` not working properly on environment276 and context filters.277- Fixed lack of Python 3 support for bytecode caches.278- Reverted support for defining blocks in included templates as this279 broke existing templates for users.280- Fixed some warnings with hashing of undefineds and nodes if Python281 is run with warnings for Python 3.282- Added support for properly hashing undefined objects.283- Fixed a bug with the title filter not working on already uppercase284 strings.285286287Version 2.7288-----------289290(codename Translation, released on May 20th 2013)291292- Choice and prefix loaders now dispatch source and template lookup293 separately in order to work in combination with module loaders as294 advertised.295- Fixed filesizeformat.296- Added a non-silent option for babel extraction.297- Added ``urlencode`` filter that automatically quotes values for298 URL safe usage with utf-8 as only supported encoding. If applications299 want to change this encoding they can override the filter.300- Added ``keep-trailing-newline`` configuration to environments and301 templates to optionally preserve the final trailing newline.302- Accessing ``last`` on the loop context no longer causes the iterator303 to be consumed into a list.304- Python requirement changed: 2.6, 2.7 or >= 3.3 are required now,305 supported by same source code, using the "six" compatibility library.306- Allow ``contextfunction`` and other decorators to be applied to ``__call__``.307- Added support for changing from newline to different signs in the ``wordwrap``308 filter.309- Added support for ignoring memcache errors silently.310- Added support for keeping the trailing newline in templates.311- Added finer grained support for stripping whitespace on the left side312 of blocks.313- Added ``map``, ``select``, ``reject``, ``selectattr`` and ``rejectattr``314 filters.315- Added support for ``loop.depth`` to figure out how deep inside a recursive316 loop the code is.317- Disabled py_compile for pypy and python 3.318319320Version 2.6321-----------322323(codename Convolution, released on July 24th 2011)324325- internal attributes now raise an internal attribute error now instead326 of returning an undefined. This fixes problems when passing undefined327 objects to Python semantics expecting APIs.328- traceback support now works properly for PyPy. (Tested with 1.4)329- implemented operator intercepting for sandboxed environments. This330 allows application developers to disable builtin operators for better331 security. (For instance limit the mathematical operators to actual332 integers instead of longs)333- groupby filter now supports dotted notation for grouping by attributes334 of attributes.335- scoped blocks now properly treat toplevel assignments and imports.336 Previously an import suddenly "disappeared" in a scoped block.337- automatically detect newer Python interpreter versions before loading code338 from bytecode caches to prevent segfaults on invalid opcodes. The segfault339 in earlier Jinja2 versions here was not a Jinja2 bug but a limitation in340 the underlying Python interpreter. If you notice Jinja2 segfaulting in341 earlier versions after an upgrade of the Python interpreter you don't have342 to upgrade, it's enough to flush the bytecode cache. This just no longer343 makes this necessary, Jinja2 will automatically detect these cases now.344- the sum filter can now sum up values by attribute. This is a backwards345 incompatible change. The argument to the filter previously was the346 optional starting index which defaults to zero. This now became the347 second argument to the function because it's rarely used.348- like sum, sort now also makes it possible to order items by attribute.349- like sum and sort, join now also is able to join attributes of objects350 as string.351- the internal eval context now has a reference to the environment.352- added a mapping test to see if an object is a dict or an object with353 a similar interface.354355356Version 2.5.5357-------------358359(re-release of 2.5.4 with built documentation removed for filesize.360 Released on October 18th 2010)361362- built documentation is no longer part of release.363364365Version 2.5.4366-------------367368(bugfix release, released on October 17th 2010)369370- Fixed extensions not loading properly with overlays.371- Work around a bug in cpython for the debugger that causes segfaults372 on 64bit big-endian architectures.373374375Version 2.5.3376-------------377378(bugfix release, released on October 17th 2010)379380- fixed an operator precedence error introduced in 2.5.2. Statements381 like "-foo.bar" had their implicit parentheses applied around the382 first part of the expression ("(-foo).bar") instead of the more383 correct "-(foo.bar)".384385386Version 2.5.2387-------------388(bugfix release, released on August 18th 2010)389390- improved setup.py script to better work with assumptions people391 might still have from it (``--with-speedups``).392- fixed a packaging error that excluded the new debug support.393394395Version 2.5.1396-------------397398(bugfix release, released on August 17th 2010)399400- StopIteration exceptions raised by functions called from templates401 are now intercepted and converted to undefineds. This solves a402 lot of debugging grief. (StopIteration is used internally to403 abort template execution)404- improved performance of macro calls slightly.405- babel extraction can now properly extract newstyle gettext calls.406- using the variable ``num`` in newstyle gettext for something else407 than the pluralize count will no longer raise a :exc:`KeyError`.408- removed builtin markup class and switched to markupsafe. For backwards409 compatibility the pure Python implementation still exists but is410 pulled from markupsafe by the Jinja2 developers. The debug support411 went into a separate feature called "debugsupport" and is disabled412 by default because it is only relevant for Python 2.4413- fixed an issue with unary operators having the wrong precedence.414415416Version 2.5417-----------418419(codename Incoherence, released on May 29th 2010)420421- improved the sort filter (should have worked like this for a422 long time) by adding support for case insensitive searches.423- fixed a bug for getattribute constant folding.424- support for newstyle gettext translations which result in a425 nicer in-template user interface and more consistent426 catalogs. (:ref:`newstyle-gettext`)427- it's now possible to register extensions after an environment428 was created.429430431Version 2.4.1432-------------433434(bugfix release, released on April 20th 2010)435436- fixed an error reporting bug for undefineds.437438439Version 2.4440-----------441442(codename Correlation, released on April 13th 2010)443444- the environment template loading functions now transparently445 pass through a template object if it was passed to it. This446 makes it possible to import or extend from a template object447 that was passed to the template.448- added a :class:`ModuleLoader` that can load templates from449 precompiled sources. The environment now features a method450 to compile the templates from a configured loader into a zip451 file or folder.452- the _speedups C extension now supports Python 3.453- added support for autoescaping toggling sections and support454 for evaluation contexts (:ref:`eval-context`).455- extensions have a priority now.456457458Version 2.3.1459-------------460461(bugfix release, released on February 19th 2010)462463- fixed an error reporting bug on all python versions464- fixed an error reporting bug on Python 2.4465466467Version 2.3468-----------469470(codename 3000 Pythons, released on February 10th 2010)471472- fixes issue with code generator that causes unbound variables473 to be generated if set was used in if-blocks and other small474 identifier problems.475- include tags are now able to select between multiple templates476 and take the first that exists, if a list of templates is477 given.478- fixed a problem with having call blocks in outer scopes that479 have an argument that is also used as local variable in an480 inner frame (#360).481- greatly improved error message reporting (#339)482- implicit tuple expressions can no longer be totally empty.483 This change makes ``{% if %}...{% endif %}`` a syntax error484 now. (#364)485- added support for translator comments if extracted via babel.486- added with-statement extension.487- experimental Python 3 support.488489490Version 2.2.1491-------------492493(bugfix release, released on September 14th 2009)494495- fixes some smaller problems for Jinja2 on Jython.496497498Version 2.2499-----------500501(codename Kong, released on September 13th 2009)502503- Include statements can now be marked with ``ignore missing`` to skip504 non existing templates.505- Priority of ``not`` raised. It's now possible to write `not foo in bar`506 as an alias to `foo not in bar` like in python. Previously the grammar507 required parentheses (`not (foo in bar)`) which was odd.508- Fixed a bug that caused syntax errors when defining macros or using the509 `{% call %}` tag inside loops.510- Fixed a bug in the parser that made ``{{ foo[1, 2] }}`` impossible.511- Made it possible to refer to names from outer scopes in included templates512 that were unused in the callers frame (#327)513- Fixed a bug that caused internal errors if names where used as iteration514 variable and regular variable *after* the loop if that variable was unused515 *before* the loop. (#331)516- Added support for optional ``scoped`` modifier to blocks.517- Added support for line-comments.518- Added the ``meta`` module.519- Renamed (undocumented) attribute "overlay" to "overlayed" on the520 environment because it was clashing with a method of the same name.521- speedup extension is now disabled by default.522523524Version 2.1.1525-------------526527(bugfix release, released on December 25th 2008)528529- Fixed a translation error caused by looping over empty recursive loops.530531532Version 2.1533-----------534535(codename Yasuzō, released on November 23rd 2008)536537- fixed a bug with nested loops and the special loop variable. Before the538 change an inner loop overwrote the loop variable from the outer one after539 iteration.540- fixed a bug with the i18n extension that caused the explicit pluralization541 block to look up the wrong variable.542- fixed a limitation in the lexer that made ``{{ foo.0.0 }}`` impossible.543- index based subscribing of variables with a constant value returns an544 undefined object now instead of raising an index error. This was a bug545 caused by eager optimizing.546- the i18n extension looks up ``foo.ugettext`` now followed by ``foo.gettext``547 if an translations object is installed. This makes dealing with custom548 translations classes easier.549- fixed a confusing behavior with conditional extending. loops were partially550 executed under some conditions even though they were not part of a visible551 area.552- added ``sort`` filter that works like ``dictsort`` but for arbitrary sequences.553- fixed a bug with empty statements in macros.554- implemented a bytecode cache system. (:ref:`bytecode-cache`)555- the template context is now weakref-able556- inclusions and imports "with context" forward all variables now, not only557 the initial context.558- added a cycle helper called ``cycler``.559- added a joining helper called ``joiner``.560- added a ``compile_expression`` method to the environment that allows compiling561 of Jinja expressions into callable Python objects.562- fixed an escaping bug in urlize563564565Version 2.0566-----------567568(codename jinjavitus, released on July 17th 2008)569570- the subscribing of objects (looking up attributes and items) changed from571 slightly. It's now possible to give attributes or items a higher priority572 by either using dot-notation lookup or the bracket syntax. This also573 changed the AST slightly. ``Subscript`` is gone and was replaced with574 :class:`~jinja2.nodes.Getitem` and :class:`~jinja2.nodes.Getattr`.575576 For more information see :ref:`the implementation details <notes-on-subscriptions>`.577- added support for preprocessing and token stream filtering for extensions.578 This would allow extensions to allow simplified gettext calls in template579 data and something similar.580- added :meth:`jinja2.environment.TemplateStream.dump`.581- added missing support for implicit string literal concatenation.582 ``{{ "foo" "bar" }}`` is equivalent to ``{{ "foobar" }}``583- ``else`` is optional for conditional expressions. If not given it evaluates584 to ``false``.585- improved error reporting for undefined values by providing a position.586- ``filesizeformat`` filter uses decimal prefixes now per default and can be587 set to binary mode with the second parameter.588- fixed bug in finalizer589590591Version 2.0rc1592--------------593594(no codename, released on June 9th 2008)595596- first release of Jinja2
modified:MANIFEST.in+8 added-12 removed
1include MANIFEST.in Makefile CHANGES LICENSE AUTHORS run-tests.py2recursive-include docs *3recursive-include custom_fixers *4recursive-include ext *5recursive-include artwork *6recursive-include examples *7recursive-include jinja2/testsuite/res *8recursive-exclude docs/_build *9recursive-exclude jinja2 *.pyc10recursive-exclude docs *.pyc11recursive-exclude jinja2 *.pyo12recursive-exclude docs *.pyo1include AUTHORS CHANGES.rst LICENSE2global-exclude *.py[co]3graft artwork4graft docs5prune docs/_build6graft examples7graft ext8graft tests