Merge pull request #417 from Unrud/patch-14
Allow creation of empty collection via PUT
This commit is contained in:
commit
13a7f2f9af
@ -548,14 +548,19 @@ class Application:
|
|||||||
# Case 1: No item and no ETag precondition: Add new item
|
# Case 1: No item and no ETag precondition: Add new item
|
||||||
# Case 2: Item and ETag precondition verified: Modify item
|
# Case 2: Item and ETag precondition verified: Modify item
|
||||||
# Case 3: Item and no Etag precondition: Force modifying item
|
# Case 3: Item and no Etag precondition: Force modifying item
|
||||||
items = list(vobject.readComponents(content))
|
items = list(vobject.readComponents(content or ""))
|
||||||
if items:
|
|
||||||
if item:
|
if item:
|
||||||
# PUT is modifying an existing item
|
# PUT is modifying an existing item
|
||||||
|
if items:
|
||||||
new_item = collection.update(item_name, items[0])
|
new_item = collection.update(item_name, items[0])
|
||||||
|
else:
|
||||||
|
new_item = None
|
||||||
elif item_name:
|
elif item_name:
|
||||||
# PUT is adding a new item
|
# PUT is adding a new item
|
||||||
|
if items:
|
||||||
new_item = collection.upload(item_name, items[0])
|
new_item = collection.upload(item_name, items[0])
|
||||||
|
else:
|
||||||
|
new_item = None
|
||||||
else:
|
else:
|
||||||
# PUT is replacing the whole collection
|
# PUT is replacing the whole collection
|
||||||
collection.delete()
|
collection.delete()
|
||||||
|
Loading…
Reference in New Issue
Block a user