mirror of https://github.com/pallets/flask.git
Merge branch '2.0.x'
This commit is contained in:
commit
ea66c68553
|
@ -32,6 +32,8 @@ jobs:
|
||||||
- {name: '3.8', python: '3.8', os: ubuntu-latest, tox: py38}
|
- {name: '3.8', python: '3.8', os: ubuntu-latest, tox: py38}
|
||||||
- {name: '3.7', python: '3.7', os: ubuntu-latest, tox: py37}
|
- {name: '3.7', python: '3.7', os: ubuntu-latest, tox: py37}
|
||||||
- {name: 'PyPy', python: 'pypy-3.7', os: ubuntu-latest, tox: pypy37}
|
- {name: 'PyPy', python: 'pypy-3.7', os: ubuntu-latest, tox: pypy37}
|
||||||
|
- {name: 'Pallets Minimum Versions', python: '3.10', os: ubuntu-latest, tox: py-min}
|
||||||
|
- {name: 'Pallets Development Versions', python: '3.7', os: ubuntu-latest, tox: py-dev}
|
||||||
- {name: Typing, python: '3.10', os: ubuntu-latest, tox: typing}
|
- {name: Typing, python: '3.10', os: ubuntu-latest, tox: typing}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
11
CHANGES.rst
11
CHANGES.rst
|
@ -30,6 +30,17 @@ Unreleased
|
||||||
- ``filename`` is renamed to ``path``.
|
- ``filename`` is renamed to ``path``.
|
||||||
|
|
||||||
|
|
||||||
|
Version 2.0.3
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Unreleased
|
||||||
|
|
||||||
|
- The test client's ``as_tuple`` parameter is deprecated and will be
|
||||||
|
removed in Werkzeug 2.1. It is now also deprecated in Flask, to be
|
||||||
|
removed in Flask 2.1, while remaining compatible with both in
|
||||||
|
2.0.x. Use ``response.request.environ`` instead. :pr:`4341`
|
||||||
|
|
||||||
|
|
||||||
Version 2.0.2
|
Version 2.0.2
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
|
|
@ -468,7 +468,7 @@ Here is a basic introduction to how the :class:`~markupsafe.Markup` class works:
|
||||||
>>> Markup.escape('<blink>hacker</blink>')
|
>>> Markup.escape('<blink>hacker</blink>')
|
||||||
Markup('<blink>hacker</blink>')
|
Markup('<blink>hacker</blink>')
|
||||||
>>> Markup('<em>Marked up</em> » HTML').striptags()
|
>>> Markup('<em>Marked up</em> » HTML').striptags()
|
||||||
'Marked up \xbb HTML'
|
'Marked up » HTML'
|
||||||
|
|
||||||
.. versionchanged:: 0.5
|
.. versionchanged:: 0.5
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
https://github.com/pallets/werkzeug/archive/refs/heads/main.tar.gz
|
||||||
|
https://github.com/pallets/jinja/archive/refs/heads/main.tar.gz
|
||||||
|
https://github.com/pallets/markupsafe/archive/refs/heads/main.tar.gz
|
||||||
|
https://github.com/pallets/itsdangerous/archive/refs/heads/main.tar.gz
|
||||||
|
https://github.com/pallets/click/archive/refs/heads/main.tar.gz
|
|
@ -0,0 +1,18 @@
|
||||||
|
#
|
||||||
|
# This file is autogenerated by pip-compile with python 3.10
|
||||||
|
# To update, run:
|
||||||
|
#
|
||||||
|
# pip-compile requirements/tests-pallets-dev.in
|
||||||
|
#
|
||||||
|
click @ https://github.com/pallets/click/archive/refs/heads/main.tar.gz
|
||||||
|
# via -r requirements/tests-pallets-dev.in
|
||||||
|
itsdangerous @ https://github.com/pallets/itsdangerous/archive/refs/heads/main.tar.gz
|
||||||
|
# via -r requirements/tests-pallets-dev.in
|
||||||
|
jinja2 @ https://github.com/pallets/jinja/archive/refs/heads/main.tar.gz
|
||||||
|
# via -r requirements/tests-pallets-dev.in
|
||||||
|
markupsafe @ https://github.com/pallets/markupsafe/archive/refs/heads/main.tar.gz
|
||||||
|
# via
|
||||||
|
# -r requirements/tests-pallets-dev.in
|
||||||
|
# jinja2
|
||||||
|
werkzeug @ https://github.com/pallets/werkzeug/archive/refs/heads/main.tar.gz
|
||||||
|
# via -r requirements/tests-pallets-dev.in
|
|
@ -0,0 +1,5 @@
|
||||||
|
Werkzeug==2.0.0
|
||||||
|
Jinja2==3.0.0
|
||||||
|
MarkupSafe==2.0.0
|
||||||
|
itsdangerous==2.0.0
|
||||||
|
click==8.0.0
|
|
@ -0,0 +1,18 @@
|
||||||
|
#
|
||||||
|
# This file is autogenerated by pip-compile with python 3.10
|
||||||
|
# To update, run:
|
||||||
|
#
|
||||||
|
# pip-compile requirements/tests-pallets-min.in
|
||||||
|
#
|
||||||
|
click==8.0.0
|
||||||
|
# via -r requirements/tests-pallets-min.in
|
||||||
|
itsdangerous==2.0.0
|
||||||
|
# via -r requirements/tests-pallets-min.in
|
||||||
|
jinja2==3.0.0
|
||||||
|
# via -r requirements/tests-pallets-min.in
|
||||||
|
markupsafe==2.0.0
|
||||||
|
# via
|
||||||
|
# -r requirements/tests-pallets-min.in
|
||||||
|
# jinja2
|
||||||
|
werkzeug==2.0.0
|
||||||
|
# via -r requirements/tests-pallets-min.in
|
|
@ -9,14 +9,15 @@ from werkzeug.test import Client
|
||||||
from werkzeug.urls import url_parse
|
from werkzeug.urls import url_parse
|
||||||
from werkzeug.wrappers import Request as BaseRequest
|
from werkzeug.wrappers import Request as BaseRequest
|
||||||
|
|
||||||
from . import _request_ctx_stack
|
|
||||||
from .cli import ScriptInfo
|
from .cli import ScriptInfo
|
||||||
|
from .globals import _request_ctx_stack
|
||||||
from .json import dumps as json_dumps
|
from .json import dumps as json_dumps
|
||||||
from .sessions import SessionMixin
|
from .sessions import SessionMixin
|
||||||
|
|
||||||
if t.TYPE_CHECKING:
|
if t.TYPE_CHECKING:
|
||||||
|
from werkzeug.test import TestResponse
|
||||||
|
|
||||||
from .app import Flask
|
from .app import Flask
|
||||||
from .wrappers import Response
|
|
||||||
|
|
||||||
|
|
||||||
class EnvironBuilder(werkzeug.test.EnvironBuilder):
|
class EnvironBuilder(werkzeug.test.EnvironBuilder):
|
||||||
|
@ -171,14 +172,15 @@ class FlaskClient(Client):
|
||||||
headers = resp.get_wsgi_headers(c.request.environ)
|
headers = resp.get_wsgi_headers(c.request.environ)
|
||||||
self.cookie_jar.extract_wsgi(c.request.environ, headers)
|
self.cookie_jar.extract_wsgi(c.request.environ, headers)
|
||||||
|
|
||||||
def open( # type: ignore
|
def open(
|
||||||
self,
|
self,
|
||||||
*args: t.Any,
|
*args: t.Any,
|
||||||
as_tuple: bool = False,
|
|
||||||
buffered: bool = False,
|
buffered: bool = False,
|
||||||
follow_redirects: bool = False,
|
follow_redirects: bool = False,
|
||||||
**kwargs: t.Any,
|
**kwargs: t.Any,
|
||||||
) -> "Response":
|
) -> "TestResponse":
|
||||||
|
as_tuple = kwargs.pop("as_tuple", None)
|
||||||
|
|
||||||
# Same logic as super.open, but apply environ_base and preserve_context.
|
# Same logic as super.open, but apply environ_base and preserve_context.
|
||||||
request = None
|
request = None
|
||||||
|
|
||||||
|
@ -213,12 +215,28 @@ class FlaskClient(Client):
|
||||||
finally:
|
finally:
|
||||||
builder.close()
|
builder.close()
|
||||||
|
|
||||||
return super().open( # type: ignore
|
if as_tuple is not None:
|
||||||
request,
|
import warnings
|
||||||
as_tuple=as_tuple,
|
|
||||||
buffered=buffered,
|
warnings.warn(
|
||||||
follow_redirects=follow_redirects,
|
"'as_tuple' is deprecated and will be removed in"
|
||||||
)
|
" Werkzeug 2.1 and Flask 2.1. Use"
|
||||||
|
" 'response.request.environ' instead.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=3,
|
||||||
|
)
|
||||||
|
return super().open(
|
||||||
|
request,
|
||||||
|
as_tuple=as_tuple,
|
||||||
|
buffered=buffered,
|
||||||
|
follow_redirects=follow_redirects,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return super().open(
|
||||||
|
request,
|
||||||
|
buffered=buffered,
|
||||||
|
follow_redirects=follow_redirects,
|
||||||
|
)
|
||||||
|
|
||||||
def __enter__(self) -> "FlaskClient":
|
def __enter__(self) -> "FlaskClient":
|
||||||
if self.preserve_context:
|
if self.preserve_context:
|
||||||
|
@ -272,7 +290,7 @@ class FlaskCliRunner(CliRunner):
|
||||||
:return: a :class:`~click.testing.Result` object.
|
:return: a :class:`~click.testing.Result` object.
|
||||||
"""
|
"""
|
||||||
if cli is None:
|
if cli is None:
|
||||||
cli = self.app.cli
|
cli = self.app.cli # type: ignore
|
||||||
|
|
||||||
if "obj" not in kwargs:
|
if "obj" not in kwargs:
|
||||||
kwargs["obj"] = ScriptInfo(create_app=lambda: self.app)
|
kwargs["obj"] = ScriptInfo(create_app=lambda: self.app)
|
||||||
|
|
4
tox.ini
4
tox.ini
|
@ -1,6 +1,8 @@
|
||||||
[tox]
|
[tox]
|
||||||
envlist =
|
envlist =
|
||||||
py3{11,10,9,8,7},pypy3{8,7}
|
py3{11,10,9,8,7},pypy3{8,7}
|
||||||
|
py310-min
|
||||||
|
py37-dev
|
||||||
style
|
style
|
||||||
typing
|
typing
|
||||||
docs
|
docs
|
||||||
|
@ -9,6 +11,8 @@ skip_missing_interpreters = true
|
||||||
[testenv]
|
[testenv]
|
||||||
deps =
|
deps =
|
||||||
-r requirements/tests.txt
|
-r requirements/tests.txt
|
||||||
|
min: -r requirements/tests-pallets-min.txt
|
||||||
|
dev: -r requirements/tests-pallets-dev.txt
|
||||||
|
|
||||||
examples/tutorial[test]
|
examples/tutorial[test]
|
||||||
examples/javascript[test]
|
examples/javascript[test]
|
||||||
|
|
Loading…
Reference in New Issue