inveniosoftware / invenio-rest

REST API support for Invenio.
https://invenio-rest.readthedocs.io
MIT License
2 stars 41 forks source link

views: fix calls to make_response (API for REST views) #44

Open lnielsen opened 8 years ago

lnielsen commented 8 years ago

Problem:

When you define a view method in a subclass of ContentNegotiatedMethodView you can currently return (retval):

See here

This causes confusion with Flask's make_response which behaves differently, and it also makes it hard to 1) get a consistent API for serialisers over many modules 2) change simple things like e.g. response code while keeping the serialiser the same.

Example: GET/POST serialisation of an object is likely the same, but often response code will be 200 vs 201/202.

Proposals

jirikuncar commented 8 years ago

@lnielsen can you provide an example how do you want to change the serializer API?

hachreak commented 8 years ago

there are any news about this proposal?

lnielsen commented 8 years ago

Proposal is still valid and I think should be fixed prior to final release. For both proposal A and B, we need to check all uses of ContentNegotiatedMethodView in other modules.

I would probably go with proposal A which involves: