Commit ab73ab61 authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

pithos: Change conflict handling in object write

Pithos in case of missing blocks during smart object write
(using hashmap) used to raise an api fault with payload
the list with the missing blocks serialized in json format.

However, the common api_method decorator in case of api fault
returns a different response content format containing details about
the fault.

This causes problem to pithos clients which expect
a specific response content format in that case.

The solution was adopted is:
when pithos server detects such a case returns directly
an HttpResponse with the same status code (409) as before
and the expected content.
parent 3b538afa
......@@ -1066,7 +1066,10 @@ def object_write(request, v_account, v_container, v_object):
except NotAllowedError:
raise faults.Forbidden('Not allowed')
except IndexError, e:
raise faults.Conflict(simple_list_response(request,
missing_blocks =
response = HttpResponse(status=409)
response.content = simple_list_response(request, missing_blocks)
return response
except ItemNotExists:
raise faults.ItemNotFound('Container does not exist')
except ValueError:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment