-
-
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
Pluggable Method Views broken by fix for #570 #794
Comments
Same problem here, as referenced in #796. Some code works for 0.9 and breaks in 0.10. |
Ignore me. |
Actually this has been fixed with 44e39ab |
Ok, after digging around, I figured out the problem. If you call If you call If you run Not an obvious complication. One I glossed over each time I reviewed the code and the Docs concerning |
Working as intended. If you use class based views and you assign more than one rule to the same handler you need to actually use the same handler. eg: create the view function once, bind it to a local variable and then assign it multiple times. The old behavior of silently ignoring it was dangerous as it did not inform you that you created and destroyed your handler multiple times and only the last one won. |
Hello, I seem to be getting this error with the latest version of flask(0.11). I've tried ajford's solution but its still not working. |
@michaelbukachi that solution (creating the view once and adding rules with it multiple times) is correct. If you have questions about your own code please ask on Stack Overflow with a Minimal, Complete, and Verifiable Example. |
Sorry about that. Found the bug in my code. I feel so silly:) |
So I'm not sure if this is meant to happen, but when you attempt to use MethodViews as described in the docs http://flask.pocoo.org/docs/views/#method-views-for-apis, I get an Assertion Error generated by the app.add_url_rule added in 661ee54. This commit was created to fix #570.
The MethodView example in the docs calls for registering multiple routes to the same class, which causes an AssertionError to be raised.
Is there another way to create a method based set of views without causing this error to be raised? Would it be better to switch from an AssertionError to a Warning that could be ignored?
The text was updated successfully, but these errors were encountered: