|
@@ -23,6 +23,7 @@ from typing import Optional
|
|
|
|
|
|
|
|
from radicale import httputils, storage, types, xmlutils
|
|
from radicale import httputils, storage, types, xmlutils
|
|
|
from radicale.app.base import Access, ApplicationBase
|
|
from radicale.app.base import Access, ApplicationBase
|
|
|
|
|
+from radicale.hook import HookNotificationItem, HookNotificationItemTypes
|
|
|
|
|
|
|
|
|
|
|
|
|
def xml_delete(base_prefix: str, path: str, collection: storage.BaseCollection,
|
|
def xml_delete(base_prefix: str, path: str, collection: storage.BaseCollection,
|
|
@@ -67,12 +68,30 @@ class ApplicationPartDelete(ApplicationBase):
|
|
|
if if_match not in ("*", item.etag):
|
|
if if_match not in ("*", item.etag):
|
|
|
# ETag precondition not verified, do not delete item
|
|
# ETag precondition not verified, do not delete item
|
|
|
return httputils.PRECONDITION_FAILED
|
|
return httputils.PRECONDITION_FAILED
|
|
|
|
|
+ hook_notification_item_list = []
|
|
|
if isinstance(item, storage.BaseCollection):
|
|
if isinstance(item, storage.BaseCollection):
|
|
|
|
|
+ for i in item.get_all():
|
|
|
|
|
+ hook_notification_item_list.append(
|
|
|
|
|
+ HookNotificationItem(
|
|
|
|
|
+ HookNotificationItemTypes.DELETE,
|
|
|
|
|
+ access.path,
|
|
|
|
|
+ i.uid
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
xml_answer = xml_delete(base_prefix, path, item)
|
|
xml_answer = xml_delete(base_prefix, path, item)
|
|
|
else:
|
|
else:
|
|
|
assert item.collection is not None
|
|
assert item.collection is not None
|
|
|
assert item.href is not None
|
|
assert item.href is not None
|
|
|
|
|
+ hook_notification_item_list.append(
|
|
|
|
|
+ HookNotificationItem(
|
|
|
|
|
+ HookNotificationItemTypes.DELETE,
|
|
|
|
|
+ access.path,
|
|
|
|
|
+ item.uid
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
xml_answer = xml_delete(
|
|
xml_answer = xml_delete(
|
|
|
base_prefix, path, item.collection, item.href)
|
|
base_prefix, path, item.collection, item.href)
|
|
|
|
|
+ for notification_item in hook_notification_item_list:
|
|
|
|
|
+ self._hook.notify(notification_item)
|
|
|
headers = {"Content-Type": "text/xml; charset=%s" % self._encoding}
|
|
headers = {"Content-Type": "text/xml; charset=%s" % self._encoding}
|
|
|
return client.OK, headers, self._xml_response(xml_answer)
|
|
return client.OK, headers, self._xml_response(xml_answer)
|