aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/Flask/py3/flask/debughelpers.py
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2025-01-16 19:09:30 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2025-01-16 19:38:51 +0300
commit7a23ad1fa2a5561a3575177d7240d8a1aa499718 (patch)
treeb4932bad31f595149e7a42e88cf729919995d735 /contrib/python/Flask/py3/flask/debughelpers.py
parentfbb15f5ab8a61fc7c50500e2757af0b47174d825 (diff)
downloadydb-7a23ad1fa2a5561a3575177d7240d8a1aa499718.tar.gz
Intermediate changes
commit_hash:ae9e37c897fc6d514389f7089184df33bf781005
Diffstat (limited to 'contrib/python/Flask/py3/flask/debughelpers.py')
-rw-r--r--contrib/python/Flask/py3/flask/debughelpers.py22
1 files changed, 3 insertions, 19 deletions
diff --git a/contrib/python/Flask/py3/flask/debughelpers.py b/contrib/python/Flask/py3/flask/debughelpers.py
index 27d378c24a4..b0639892c45 100644
--- a/contrib/python/Flask/py3/flask/debughelpers.py
+++ b/contrib/python/Flask/py3/flask/debughelpers.py
@@ -1,10 +1,8 @@
-import os
import typing as t
-from warnings import warn
from .app import Flask
from .blueprints import Blueprint
-from .globals import _request_ctx_stack
+from .globals import request_ctx
class UnexpectedUnicodeError(AssertionError, UnicodeError):
@@ -118,9 +116,8 @@ def explain_template_loading_attempts(app: Flask, template, attempts) -> None:
info = [f"Locating template {template!r}:"]
total_found = 0
blueprint = None
- reqctx = _request_ctx_stack.top
- if reqctx is not None and reqctx.request.blueprint is not None:
- blueprint = reqctx.request.blueprint
+ if request_ctx and request_ctx.request.blueprint is not None:
+ blueprint = request_ctx.request.blueprint
for idx, (loader, srcobj, triple) in enumerate(attempts):
if isinstance(srcobj, Flask):
@@ -159,16 +156,3 @@ def explain_template_loading_attempts(app: Flask, template, attempts) -> None:
info.append(" See https://flask.palletsprojects.com/blueprints/#templates")
app.logger.info("\n".join(info))
-
-
-def explain_ignored_app_run() -> None:
- if os.environ.get("WERKZEUG_RUN_MAIN") != "true":
- warn(
- Warning(
- "Silently ignoring app.run() because the application is"
- " run from the flask command line executable. Consider"
- ' putting app.run() behind an if __name__ == "__main__"'
- " guard to silence this warning."
- ),
- stacklevel=3,
- )