NAMD / pypln.web

Web interface for PyPLN
http://pypln.org/
GNU General Public License v3.0
12 stars 8 forks source link

Avoid KeyError when there are no analysis ready for a document #99

Closed flavioamieiro closed 11 years ago

flavioamieiro commented 11 years ago

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.

turicas commented 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.

turicas commented 11 years ago

Another good feature will be use the response headers on verb HEAD to retrieve the status of the document.