1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-08-01 18:18:31 +00:00

Addd hook capability

This commit is contained in:
Tuna Celik 2020-08-17 02:05:02 +02:00
parent 03e7e209da
commit 5253a464ab
7 changed files with 103 additions and 2 deletions

View file

@ -21,6 +21,7 @@ from http import client
from xml.etree import ElementTree as ET
from radicale import app, httputils, storage, xmlutils
from radicale.hook.rabbitmq import QueueItem, QueueItemTypes
def xml_delete(base_prefix, path, collection, href=None):
@ -64,8 +65,11 @@ class ApplicationDeleteMixin:
return httputils.PRECONDITION_FAILED
if isinstance(item, storage.BaseCollection):
xml_answer = xml_delete(base_prefix, path, item)
for item in item.get_all():
self._hook.notify(QueueItem(QueueItemTypes.DELETE, item.uid))
else:
xml_answer = xml_delete(
base_prefix, path, item.collection, item.href)
self._hook.notify(QueueItem(QueueItemTypes.DELETE, item.uid))
headers = {"Content-Type": "text/xml; charset=%s" % self._encoding}
return client.OK, headers, self._write_xml_content(xml_answer)