Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into custom_escape
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGES.rst
#	src/jinja2/compiler.py
#	src/jinja2/environment.py
#	src/jinja2/filters.py
#	src/jinja2/runtime.py
  • Loading branch information
CarliJoy committed Jan 4, 2022
2 parents ee08594 + 11065b5 commit 7bba79f
Show file tree
Hide file tree
Showing 50 changed files with 578 additions and 741 deletions.
23 changes: 15 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
- package-ecosystem: "pip"
directory: "/requirements"
target-branch: "3.0.x"
versioning-strategy: "lockfile-only"
schedule:
interval: monthly
time: "08:00"
interval: "monthly"
day: "monday"
time: "16:00"
timezone: "UTC"
open-pull-requests-limit: 99
ignore:
- dependency-name: sphinx
versions:
- "> 2.4.4"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
day: "monday"
time: "16:00"
timezone: "UTC"
6 changes: 3 additions & 3 deletions .github/workflows/lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v2
- uses: dessant/lock-threads@v3
with:
github-token: ${{ github.token }}
issue-lock-inactive-days: 14
pr-lock-inactive-days: 14
issue-inactive-days: 14
pr-inactive-days: 14
13 changes: 7 additions & 6 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ jobs:
fail-fast: false
matrix:
include:
- {name: Linux, python: '3.9', os: ubuntu-latest, tox: py39}
- {name: Windows, python: '3.9', os: windows-latest, tox: py39}
- {name: Mac, python: '3.9', os: macos-latest, tox: py39}
- {name: Linux, python: '3.10', os: ubuntu-latest, tox: py310}
- {name: Windows, python: '3.10', os: windows-latest, tox: py310}
- {name: Mac, python: '3.10', os: macos-latest, tox: py310}
- {name: '3.11-dev', python: '3.11-dev', os: ubuntu-latest, tox: py311}
- {name: '3.9', python: '3.9', os: ubuntu-latest, tox: py39}
- {name: '3.8', python: '3.8', os: ubuntu-latest, tox: py38}
- {name: '3.7', python: '3.7', os: ubuntu-latest, tox: py37}
- {name: '3.6', python: '3.6', os: ubuntu-latest, tox: py36}
- {name: 'PyPy', python: pypy3, os: ubuntu-latest, tox: pypy3}
- {name: Typing, python: '3.9', os: ubuntu-latest, tox: typing}
- {name: 'PyPy', python: 'pypy-3.7', os: ubuntu-latest, tox: pypy37}
- {name: Typing, python: '3.10', os: ubuntu-latest, tox: typing}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@ ci:
autoupdate_schedule: monthly
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.15.0
rev: v2.29.1
hooks:
- id: pyupgrade
args: ["--py36-plus"]
args: ["--py37-plus"]
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.5.0
rev: v2.6.0
hooks:
- id: reorder-python-imports
args: ["--application-directories", "src"]
- repo: https://github.com/psf/black
rev: 21.5b1
rev: 21.12b0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 3.9.2
rev: 4.0.1
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.1.0
hooks:
- id: fix-byte-order-marker
- id: trailing-whitespace
Expand Down
4 changes: 4 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
version: 2
build:
os: ubuntu-20.04
tools:
python: "3.10"
python:
install:
- requirements: requirements/docs.txt
Expand Down
54 changes: 52 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,62 @@ Unreleased

- Allow custom autoescape functions :issue:`1377`
- Removed hardcoded Markup and escape calls
- Drop support for Python 3.6. :pr:`1534`
- Remove previously deprecated code. :pr:`1544`

- ``WithExtension`` and ``AutoEscapeExtension`` are built-in now.
- ``contextfilter`` and ``contextfunction`` are replaced by
``pass_context``. ``evalcontextfilter`` and
``evalcontextfunction`` are replaced by ``pass_eval_context``.
``environmentfilter`` and ``environmentfunction`` are replaced
by ``pass_environment``.
- ``Markup`` and ``escape`` should be imported from MarkupSafe.
- Compiled templates from very old Jinja versions may need to be
recompiled.
- Legacy resolve mode for ``Context`` subclasses is no longer
supported. Override ``resolve_or_missing`` instead of
``resolve``.
- ``unicode_urlencode`` is renamed to ``url_quote``.

- Add support for native types in macros. :issue:`1510`
- The ``{% trans %}`` tag can use ``pgettext`` and ``npgettext`` by
passing a context string as the first token in the tag, like
``{% trans "title" %}``. :issue:`1430`


Version 3.0.3
-------------

Released 2021-11-09

- Fix traceback rewriting internals for Python 3.10 and 3.11.
:issue:`1535`
- Fix how the native environment treats leading and trailing spaces
when parsing values on Python 3.10. :pr:`1537`
- Improve async performance by avoiding checks for common types.
:issue:`1514`
- Revert change to ``hash(Node)`` behavior. Nodes are hashed by id
again :issue:`1521`
- ``PackageLoader`` works when the package is a single module file.
:issue:`1512`


Version 3.0.2
-------------

Unreleased
Released 2021-10-04

- Fix a loop scoping bug that caused assignments in nested loops
to still be referenced outside of it. :issue:`1427`
- Make ``compile_templates`` deterministic for filter and import
names. :issue:`1452, 1453`
- Revert an unintended change that caused ``Undefined`` to act like
``StrictUndefined`` for the ``in`` operator. :issue:`1448`
- Imported macros have access to the current template globals in async
environments. :issue:`1494`
- ``PackageLoader`` will not include a current directory (.) path
segment. This allows loading templates from the root of a zip
import. :issue:`1467`


Version 3.0.1
Expand Down Expand Up @@ -405,7 +455,7 @@ Released 2017-01-08
possible. For more information and a discussion see :issue:`641`
- Resolved an issue where ``block scoped`` would not take advantage of
the new scoping rules. In some more exotic cases a variable
overriden in a local scope would not make it into a block.
overridden in a local scope would not make it into a block.
- Change the code generation of the ``with`` statement to be in line
with the new scoping rules. This resolves some unlikely bugs in edge
cases. This also introduces a new internal ``With`` node that can be
Expand Down
10 changes: 8 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ First time setup

.. code-block:: text
git remote add fork https://github.com/{username}/jinja
$ git remote add fork https://github.com/{username}/jinja
- Create a virtualenv.

Expand All @@ -107,6 +107,12 @@ First time setup
> env\Scripts\activate
- Upgrade pip and setuptools.

.. code-block:: text
$ python -m pip install --upgrade pip setuptools
- Install the development dependencies, then install Jinja in editable
mode.

Expand Down Expand Up @@ -138,7 +144,7 @@ Start coding
.. code-block:: text
$ git fetch origin
$ git checkout -b your-branch-name origin/1.1.x
$ git checkout -b your-branch-name origin/3.0.x
If you're submitting a feature addition or change, branch off of the
"main" branch.
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Install and update using `pip`_:
$ pip install -U Jinja2
.. _pip: https://pip.pypa.io/en/stable/quickstart/
.. _pip: https://pip.pypa.io/en/stable/getting-started/


In A Nutshell
Expand Down
14 changes: 1 addition & 13 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ modified identifier syntax. Filters and tests may contain dots to group
filters and tests by topic. For example it's perfectly valid to add a
function into the filter dict and call it `to.str`. The regular
expression for filter and test identifiers is
``[a-zA-Z_][a-zA-Z0-9_]*(\.[a-zA-Z_][a-zA-Z0-9_]*)*```.
``[a-zA-Z_][a-zA-Z0-9_]*(\.[a-zA-Z_][a-zA-Z0-9_]*)*``.


Undefined Types
Expand Down Expand Up @@ -764,18 +764,6 @@ functions to a Jinja environment.

.. autofunction:: jinja2.pass_environment

.. autofunction:: jinja2.contextfilter

.. autofunction:: jinja2.evalcontextfilter

.. autofunction:: jinja2.environmentfilter

.. autofunction:: jinja2.contextfunction

.. autofunction:: jinja2.evalcontextfunction

.. autofunction:: jinja2.environmentfunction

.. autofunction:: jinja2.clear_caches

.. autofunction:: jinja2.is_undefined
Expand Down
2 changes: 1 addition & 1 deletion docs/extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ The usage of the ``i18n`` extension for template designers is covered in
:ref:`the template documentation <i18n-in-templates>`.

.. _gettext: https://docs.python.org/3/library/gettext.html
.. _Babel: http://babel.pocoo.org/
.. _Babel: https://babel.pocoo.org/


Whitespace Trimming
Expand Down
20 changes: 0 additions & 20 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,26 +125,6 @@ instead that one can assign to a variable by using set::

{% set comments = get_latest_comments() %}

My tracebacks look weird. What's happening?
-------------------------------------------

Jinja can rewrite tracebacks so they show the template lines numbers and
source rather than the underlying compiled code, but this requires
special Python support. CPython <3.7 requires ``ctypes``, and PyPy
requires transparent proxy support.

If you are using Google App Engine, ``ctypes`` is not available. You can
make it available in development, but not in production.

.. code-block:: python
import os
if os.environ.get('SERVER_SOFTWARE', '').startswith('Dev'):
from google.appengine.tools.devappserver2.python import sandbox
sandbox._WHITE_LIST_C_MODULES += ['_ctypes', 'gestalt']
Credit for this snippet goes to `Thomas Johansson
<https://stackoverflow.com/questions/3086091/debug-jinja2-in-google-app-engine/3694434#3694434>`_

My Macros are overridden by something
-------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions docs/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Installation
------------

We recommend using the latest version of Python. Jinja supports Python
3.6 and newer. We also recommend using a `virtual environment`_ in order
3.7 and newer. We also recommend using a `virtual environment`_ in order
to isolate your project dependencies from other projects and the system.

.. _virtual environment: https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments
Expand Down Expand Up @@ -60,4 +60,4 @@ These distributions will not be installed automatically.

- `Babel`_ provides translation support in templates.

.. _Babel: http://babel.pocoo.org/
.. _Babel: https://babel.pocoo.org/
2 changes: 1 addition & 1 deletion docs/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if errorlevel 9009 (
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
echo.https://www.sphinx-doc.org/
exit /b 1
)

Expand Down
Loading

0 comments on commit 7bba79f

Please sign in to comment.