deprecate markupsafe exports

This commit is contained in:
David Lord 2023-02-23 08:55:01 -08:00
parent 1ee22e1736
commit 9c02f07f9b
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
8 changed files with 41 additions and 20 deletions

View file

@ -1,6 +1,3 @@
from markupsafe import escape
from markupsafe import Markup
from . import json as json
from .app import Flask as Flask
from .app import Request as Request
@ -68,4 +65,28 @@ def __getattr__(name):
)
return __request_ctx_stack
if name == "escape":
import warnings
from markupsafe import escape
warnings.warn(
"'flask.escape' is deprecated and will be removed in Flask 2.4. Import"
" 'markupsafe.escape' instead.",
DeprecationWarning,
stacklevel=2,
)
return escape
if name == "escape":
import warnings
from markupsafe import Markup
warnings.warn(
"'flask.Markup' is deprecated and will be removed in Flask 2.4. Import"
" 'markupsafe.Markup' instead.",
DeprecationWarning,
stacklevel=2,
)
return Markup
raise AttributeError(name)