Skip to content
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

MethodView requires settings "methods" attribute #2044

Closed
coltonlw opened this issue Sep 29, 2016 · 3 comments
Closed

MethodView requires settings "methods" attribute #2044

coltonlw opened this issue Sep 29, 2016 · 3 comments

Comments

@coltonlw
Copy link

coltonlw commented Sep 29, 2016

In the example for MethodView, post() will not be called unless methods is set on the class or with add_url_rule

https://github.com/pallets/flask/blob/master/flask/views.py#L123

A fix might be having MethodView.methods set to a copy of http_method_funcs i.e. all available methods

If I am missing something here my apologies

@coltonlw
Copy link
Author

It seems this may be intended behavior based on another example of MethodView in the docs:

http://flask.pocoo.org/docs/0.11/views/#method-views-for-apis

Maybe the fix is to change the docstring example for MethodView to show that you must set methods, I can submit a PR for that doc fix if requested

@acatton
Copy link
Contributor

acatton commented Oct 17, 2016

Isn't this the problem exposed by #1936 ?

@davidism
Copy link
Member

Not sure what's going on here. methods is populated automatically if it is not set by the class. #1936 improves on this by allowing mixins, but it should always have worked. If it doesn't, please add an example and I'll reopen this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants