-
-
Notifications
You must be signed in to change notification settings - Fork 16.2k
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
blueprint.route methods argument typo throws unclear exception #760
Comments
why do you think that this exception is misleading? |
That's hard to fix due to how they work :( |
@Turbo87 the problem is that it does not lead you to a place in your code where the mistake is. A new flask user will have to go through the code (like I did) to understand what the problem was. |
So how can I fix this issue? I'm new to Flask and Python and programming, and I'm baffled. |
@davisclark Use 'methods' as the keyword argument, i.e. |
Oh my god, that's incredible. A single route had been mistyped. After 6 hours of searching line by line, I can't thank you enough. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I don't see a practical way to do this sort of typo checking in a general way, and don't think it's useful enough to justify the complexity. PyCharm, and possibly other IDEs, detect the correct kwargs. If you're not using the IDE, you're in the same situation here as you would be with any other code that uses this pattern. If anyone has a good argument and suggestion for why and how this should work, please open a new issue. |
route method takes *options which catches all keyword arguments and passes it further to *url_rule_class which -- in case of typo like 'method' instead of 'methods' -- leads to misleading exception:
The text was updated successfully, but these errors were encountered: