-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTPException.description can no longer be None in werkzeug 2.x. #2115
Comments
This comment has been minimized.
This comment has been minimized.
@mhaas Are you also facing this error: File "/usr/local/lib/python3.6/site-packages/werkzeug/utils.py", line 553, in redirect
display_location = html.escape(location)
File "/usr/local/lib/python3.6/html/__init__.py", line 19, in escape
s = s.replace("&", "&") # Must be done first!
AttributeError: 'ResponseFailure' object has no attribute 'replace' |
Looks to be this commit (with relevant line highlighted). |
This comment has been minimized.
This comment has been minimized.
Again, you need to pin your dependencies, especially when it comes to major version upgrades. |
Not able to pin the dependencies as its configured with the pipeline. In the below, the dependencies are obtained from safety repo: https://github.com/pyupio/safety Below is how the pipeline takes: Collecting git+git://github.com/pyupio/safety.git (from -r requirements/dev.txt (line 5))
Cloning git://github.com/pyupio/safety.git to /tmp/pip-req-build-glv5sl02
Running command git clone -q git://github.com/pyupio/safety.git /tmp/pip-req-build-glv5sl02
Collecting flake8==3.7.8
Downloading flake8-3.7.8-py2.py3-none-any.whl (70 kB)
Collecting Werkzeug>=0.7
Downloading Werkzeug-2.0.0-py3-none-any.whl (288 kB)
Collecting Flask
Downloading Flask-2.0.0-py3-none-any.whl (93 kB) Please do let me know how we can pin the dependencies within our pipeline. In the project there is no mention of Werkzeug. Its reading from Safety repo. |
Use something like pip-compile to lock your direct and transitive dependencies. |
Thanks that helped, i specied the dependency explicitly in dev.txt. |
Currently using flask 1.0.2 and would like to update to flask 2.0, we throw aborts with |
In case it's not obvious, folks following this idiom will run into this error. My hacky work around (which is good enough for my toy project): Before:
After:
PS. The traceback I see is a bit different than the original reporter.
vs.
|
The werkzeug HTTPException class has a
description
property, which is allowed to beNone
according to type hints.In werkzeug 1.x, this worked fine. In werkzeug 2.x, having
description
set to None leads to an exception:I believe this error is happening because the
escape
function used inHTTPException.get_description
has been replaced. In Werkzeug 1.x, this waswerkzeug.utils.escape
which replacesNone
with the empty string""
. In werkzeug 2.x, this is now coming from Python's built-inhtml
package, which does not handleNone
.Environment:
The text was updated successfully, but these errors were encountered: