Closed flavioamieiro closed 11 years ago
If the document exists on PostgreSQL but not on MongoDB, I think the best response should be HTTP 202 - Accepted with an empty JSON (or maybe with something like {status: 'processing'}
), since the document exists but is not ready it.
I think this is the right approach since the user will receive a 2xx response (it will not generate and exception for him if he is using requests library, for example) and it won't generate an exception on the server.
Another good feature will be use the response headers on verb HEAD
to retrieve the status of the document.
When a document has no analysis ready and someone tries to access it's '/properties/' page, the view raises a KeyError, because there are no properties for that document. We need to treat this error and tell the user what is happening.