-
Notifications
You must be signed in to change notification settings - Fork 41
name 'Response' is not defined #69
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
name 'Response' is not defined #69
Comments
At current release tag of v0.13.0,
Exception stack trace such as:
Current state of dependencies (partial):
@alecthomas would you please advise here? |
Aim to resolve python-injector#69
Aim to resolve python-injector#69
The above PR #71 is the proposed fix from @FabienArcellier, and as he said, now only the case
|
Any updates here? I'm facing he same issue, hot from @FabienArcellier works for me. Anyone know what about the failing tests? |
Hitting same issue when upgrading to Flask 2.x, any workarounds available ? |
@rshah88 I forked fix from PR and now flask_injector is a part of source code of my project - it's only one file, easy to embed. It's not elegant ;) but in the meantime it's good enough. |
Hi all, |
Seems like something that's good to have anyway but the main purpose is to fix python-injector/flask_injector#69.
Seems like something that's good to have anyway but the main purpose is to fix python-injector/flask_injector#69.
Thanks to injector 0.20.0 invalid forward references in return type annotation positions no longer break injection/detecting dependencies (which is what GH-69 is actually about). This PR fixes #69 This PR also effectively reverts [1] as [1] was breaking forward reference support. One more thing being fixed here is class-based view failures that started happening for some reason, reordering some internal logic handles that (we prioritize treating views as class-based views and all is well). [1] Fixes: 4d8bfe8 ("(wip) fix: name 'Response' is not defined")
This is finally resolved in Flask-Injector 0.14.0 (fingers crossed). Warning: there are hard requirements for the latest Flask and Injector involved. |
Uh oh!
There was an error while loading. Please reload this page.
On Flask 2, I get this error every time I run a query. I have solved the issue only changing the code of Flask-Injector but I am not confident with the impact of the change I have done.
This error is present when you run the unit test suite.
The fix I propose broke the test
test_forward_references_work
:(.Version:
I track the root cause in
wrap_fun
that is supposed to managed this sort of error. On Flask,On Flask, the error is due to the usage of typehint with in
flask/scaffold.py
The function get_type_hints raise a
NameError
exception in this context.Proposition of fix
I suppose the existance of NameError has a reason but moving it in Non wrapping condition solve the issue I have. I didn't find the reason of the existence of this condition.
More information
the issue with get_type_hints and Forward Ref
The text was updated successfully, but these errors were encountered: