inveniosoftware / flask-resources

REST APIs for Flask
https://flask-resources.readthedocs.io
MIT License
3 stars 21 forks source link

views: move response handler and request loader lookup to the content-negotiation #32

Closed ppanero closed 4 years ago

ppanero commented 4 years ago

The code lines:

 _response_handler = self.response_handlers[resource_requestctx.accept_mimetype]
 _request_loader = self.request_loaders[resource_requestctx.payload_mimetype]

Are repeated almost in every single method of the views. Since the accept_mimetype and payload_mimetype are obtained, and set, in the content_negotiation decorator (which decorates views). Would it be "acceptable" to make said assignation in the decorator? Reasoning: