Repository navigation
fix(custom_static): import escape from markupsafe for Flask 3 compatibility - #216
Open
escooterclinic wants to merge 1 commit into
Open
escooterclinic wants to merge 1 commit into
escooterclinic wants to merge 1 commit into
Conversation
…bility Flask 3.0 removed the flask.escape re-export, so importing aw_server fails with ImportError on Flask 3. markupsafe is already a Flask dependency and provides the same function on Flask 2.x.
[Medium impact] The PR appears safe to merge. SummaryImports
Reviews (1) · Last reviewed commit: "fix(custom_static): import escape from m..." · Reviewed by Greptile |
Contributor
|
Thanks! CI needs to run on this head before it's ready (only Greptile has reported; the test suite hasn't run because the workflow needs approval for forks). If it passes, no further changes are needed from my side. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We run aw-server as a central server and wanted to move its venv to Flask 3.1. Importing
aw_serveron Flask 3 fails before anything starts:Flask 3.0 dropped the
flask.escapere-export (it was deprecated in 2.3). This importsescapefrommarkupsafeinstead, which is the same function and already a Flask dependency, so nothing changes on Flask 2.x.I added
tests/test_custom_static.py, which checks that the custom-static 404 message still HTML-escapes the watcher name and path. Tested on current master with Python 3.12:pyproject.tomlstill pinsflask = "^2.2"andwerkzeug = "^2.3.3", so pip won't pick Flask 3 yet. I left that alone because it also means regeneratingpoetry.lock. I can add it here or in a follow-up, whichever you'd rather. The JSON side already works on Flask 3 since 7f30c17 moved to a JSON provider.The change was prepared and tested with an AI coding agent. I reviewed it.