mirror of
https://github.com/Kozea/Radicale.git
synced 2025-09-15 20:36:55 +00:00
DELETE requests can delete calendars (closes #514)
This commit is contained in:
parent
bfe527dd41
commit
1f2f39a87a
3 changed files with 25 additions and 8 deletions
|
@ -267,8 +267,15 @@ class Application(object):
|
|||
def delete(self, environ, calendars, content, user):
|
||||
"""Manage DELETE request."""
|
||||
calendar = calendars[0]
|
||||
item = calendar.get_item(
|
||||
xmlutils.name_from_path(environ["PATH_INFO"], calendar))
|
||||
|
||||
if calendar.local_path == environ["PATH_INFO"].strip("/"):
|
||||
# Path matching the calendar, the item to delete is the calendar
|
||||
item = calendar
|
||||
else:
|
||||
# Try to get an item matching the path
|
||||
item = calendar.get_item(
|
||||
xmlutils.name_from_path(environ["PATH_INFO"], calendar))
|
||||
|
||||
if item and environ.get("HTTP_IF_MATCH", item.etag) == item.etag:
|
||||
# No ETag precondition or precondition verified, delete item
|
||||
answer = xmlutils.delete(environ["PATH_INFO"], calendar)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue