Fix a bug with DELETE requests when deleted item is not found
This commit is contained in:
parent
085c9f0aca
commit
f6ace2b6ec
@ -285,17 +285,16 @@ class Application(object):
|
||||
item = collection.get_item(
|
||||
xmlutils.name_from_path(environ["PATH_INFO"], collection))
|
||||
|
||||
if item:
|
||||
# Evolution bug workaround
|
||||
etag = environ.get("HTTP_IF_MATCH", item.etag).replace("\\", "")
|
||||
if item and etag == item.etag:
|
||||
if etag == item.etag:
|
||||
# No ETag precondition or precondition verified, delete item
|
||||
answer = xmlutils.delete(environ["PATH_INFO"], collection)
|
||||
status = client.NO_CONTENT
|
||||
else:
|
||||
return client.NO_CONTENT, {}, answer
|
||||
|
||||
# No item or ETag precondition not verified, do not delete item
|
||||
answer = None
|
||||
status = client.PRECONDITION_FAILED
|
||||
return status, {}, answer
|
||||
return client.PRECONDITION_FAILED, {}, None
|
||||
|
||||
def get(self, environ, collections, content, user):
|
||||
"""Manage GET request.
|
||||
|
Loading…
Reference in New Issue
Block a user