1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-06-26 16:45:52 +00:00

Refactoring

This commit is contained in:
Tuna Celik 2020-08-17 02:36:22 +02:00
parent 2e93c012bf
commit b2a0067a57
2 changed files with 8 additions and 8 deletions

View file

@ -66,14 +66,14 @@ class ApplicationDeleteMixin:
if isinstance(item, storage.BaseCollection): if isinstance(item, storage.BaseCollection):
xml_answer = xml_delete(base_prefix, path, item) xml_answer = xml_delete(base_prefix, path, item)
for item in item.get_all(): for item in item.get_all():
hook_notification_item = \ hook_notification_item = HookNotificationItem(
HookNotificationItem(HookNotificationItemTypes.DELETE, item.uid) HookNotificationItemTypes.DELETE, item.uid)
self._hook.notify(hook_notification_item) self._hook.notify(hook_notification_item)
else: else:
xml_answer = xml_delete( xml_answer = xml_delete(
base_prefix, path, item.collection, item.href) base_prefix, path, item.collection, item.href)
hook_notification_item = \ hook_notification_item = HookNotificationItem(
HookNotificationItem(HookNotificationItemTypes.DELETE, item.uid) HookNotificationItemTypes.DELETE, item.uid)
self._hook.notify(hook_notification_item) self._hook.notify(hook_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._write_xml_content(xml_answer) return client.OK, headers, self._write_xml_content(xml_answer)

View file

@ -195,8 +195,8 @@ class ApplicationPutMixin:
etag = self._storage.create_collection( etag = self._storage.create_collection(
path, prepared_items, props).etag path, prepared_items, props).etag
for item in prepared_items: for item in prepared_items:
hook_notification_item = \ hook_notification_item = HookNotificationItem(
HookNotificationItem(HookNotificationItemTypes.UPSERT, item.serialize()) HookNotificationItemTypes.UPSERT, item.serialize())
self._hook.notify(hook_notification_item) self._hook.notify(hook_notification_item)
except ValueError as e: except ValueError as e:
logger.warning( logger.warning(
@ -213,8 +213,8 @@ class ApplicationPutMixin:
href = posixpath.basename(pathutils.strip_path(path)) href = posixpath.basename(pathutils.strip_path(path))
try: try:
etag = parent_item.upload(href, prepared_item).etag etag = parent_item.upload(href, prepared_item).etag
hook_notification_item = \ hook_notification_item = HookNotificationItem(
HookNotificationItem(HookNotificationItemTypes.UPSERT, prepared_item.serialize()) HookNotificationItemTypes.UPSERT, prepared_item.serialize())
self._hook.notify(hook_notification_item) self._hook.notify(hook_notification_item)
except ValueError as e: except ValueError as e:
logger.warning( logger.warning(