inveniosoftware / inveniosoftware/flask-resources

Don't implement MethodView methods for missing Resource methods

Open
#54 0 comments 0 reactions 0 assignees View on GitHub
good first issue
Dominant language
Python
Stars
3
Forks
22
PR merge metrics
No merged PRs in 30d

Description

Problem: because we implement MethodView methods by default even if no corresponding Resource methods were implemented, Flask routes to our default implementation and then the ordering of errors breaks. Where one should get a 405 (because that was also the default return value), one can get a 406 or 415 first because content-type is negotiated on an endpoint that ultimately should not exist in the first place.

Solution: We probably need to use metaprogramming and do like: https://github.com/pallets/flask/blob/024f0d384cf5bb65c76ac59f8ddce464b2dc2ca1/src/flask/views.py#L100 to determine the missing methods in Resource and not register them in the blueprint. See https://github.com/inveniosoftware/flask-resources/issues/36#issuecomment-648428486 for further context.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.