Merge pull request #5026 from pallets/werkzeug-compat

replace `werkzeug.urls` with `urllib.parse`
This commit is contained in:
David Lord 2023-03-11 08:21:58 -08:00 committed by GitHub
commit cac56a2b53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 4 deletions

View file

@ -1,3 +1,11 @@
Version 2.2.4
-------------
Unreleased
- Update for compatibility with Werkzeug 2.3.
Version 2.2.3
-------------

View file

@ -11,6 +11,7 @@ from datetime import timedelta
from itertools import chain
from threading import Lock
from types import TracebackType
from urllib.parse import quote as _url_quote
import click
from werkzeug.datastructures import Headers
@ -27,7 +28,6 @@ from werkzeug.routing import RequestRedirect
from werkzeug.routing import RoutingException
from werkzeug.routing import Rule
from werkzeug.serving import is_running_from_reloader
from werkzeug.urls import url_quote
from werkzeug.utils import redirect as _wz_redirect
from werkzeug.wrappers import Response as BaseResponse
@ -2034,7 +2034,8 @@ class Flask(Scaffold):
return self.handle_url_build_error(error, endpoint, values)
if _anchor is not None:
rv = f"{rv}#{url_quote(_anchor)}"
_anchor = _url_quote(_anchor, safe="%!#$&'()*+,/:;=?@")
rv = f"{rv}#{_anchor}"
return rv

View file

@ -3,11 +3,11 @@ from contextlib import contextmanager
from contextlib import ExitStack
from copy import copy
from types import TracebackType
from urllib.parse import urlsplit
import werkzeug.test
from click.testing import CliRunner
from werkzeug.test import Client
from werkzeug.urls import url_parse
from werkzeug.wrappers import Request as BaseRequest
from .cli import ScriptInfo
@ -68,7 +68,7 @@ class EnvironBuilder(werkzeug.test.EnvironBuilder):
if url_scheme is None:
url_scheme = app.config["PREFERRED_URL_SCHEME"]
url = url_parse(path)
url = urlsplit(path)
base_url = (
f"{url.scheme or url_scheme}://{url.netloc or http_host}"
f"/{app_root.lstrip('/')}"