mirror of
https://github.com/Kozea/Radicale.git
synced 2025-09-12 20:30:57 +00:00
Code cleanup and refactoring
This commit is contained in:
parent
5253a464ab
commit
389a6b9906
5 changed files with 41 additions and 31 deletions
|
@ -21,7 +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
|
||||
from radicale.hook import HookNotificationItem, HookNotificationItemTypes
|
||||
|
||||
|
||||
def xml_delete(base_prefix, path, collection, href=None):
|
||||
|
@ -66,10 +66,14 @@ class ApplicationDeleteMixin:
|
|||
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))
|
||||
hook_notification_item = \
|
||||
HookNotificationItem(HookNotificationItemTypes.DELETE, item.uid)
|
||||
self._hook.notify(hook_notification_item)
|
||||
else:
|
||||
xml_answer = xml_delete(
|
||||
base_prefix, path, item.collection, item.href)
|
||||
self._hook.notify(QueueItem(QueueItemTypes.DELETE, item.uid))
|
||||
hook_notification_item = \
|
||||
HookNotificationItem(HookNotificationItemTypes.DELETE, item.uid)
|
||||
self._hook.notify(hook_notification_item)
|
||||
headers = {"Content-Type": "text/xml; charset=%s" % self._encoding}
|
||||
return client.OK, headers, self._write_xml_content(xml_answer)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue