From e63a6e0c85e2750605df88ebe56799cd91e8b09f Mon Sep 17 00:00:00 2001 From: Unrud Date: Sun, 24 May 2020 13:19:30 +0200 Subject: [PATCH] Cosmetics --- radicale/app/__init__.py | 2 +- radicale/app/mkcalendar.py | 3 ++- radicale/app/move.py | 5 +++-- radicale/app/put.py | 5 +++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/radicale/app/__init__.py b/radicale/app/__init__.py index a827b4f..85cbcc2 100644 --- a/radicale/app/__init__.py +++ b/radicale/app/__init__.py @@ -349,7 +349,7 @@ class Application( xml_declaration=True) return f.getvalue() - def _webdav_error_response(self, human_tag, status=client.CONFLICT): + def _webdav_error_response(self, status, human_tag): """Generate XML error response.""" headers = {"Content-Type": "text/xml; charset=%s" % self._encoding} content = self._write_xml_content(xmlutils.webdav_error(human_tag)) diff --git a/radicale/app/mkcalendar.py b/radicale/app/mkcalendar.py index 0b8d059..b7e16d9 100644 --- a/radicale/app/mkcalendar.py +++ b/radicale/app/mkcalendar.py @@ -54,7 +54,8 @@ class ApplicationMkcalendarMixin: with self._storage.acquire_lock("w", user): item = next(self._storage.discover(path), None) if item: - return self._webdav_error_response("D:resource-must-be-null") + return self._webdav_error_response( + client.CONFLICT, "D:resource-must-be-null") parent_path = pathutils.unstrip_path( posixpath.dirname(pathutils.strip_path(path)), True) parent_item = next(self._storage.discover(parent_path), None) diff --git a/radicale/app/move.py b/radicale/app/move.py index 0515e7b..c2fe71a 100644 --- a/radicale/app/move.py +++ b/radicale/app/move.py @@ -76,8 +76,9 @@ class ApplicationMoveMixin: not to_item and to_collection.path != item.collection.path and to_collection.has_uid(item.uid)): - return self._webdav_error_response("%s:no-uid-conflict" % ( - "C" if tag == "VCALENDAR" else "CR")) + return self._webdav_error_response( + client.CONFLICT, "%s:no-uid-conflict" % ( + "C" if tag == "VCALENDAR" else "CR")) to_href = posixpath.basename(pathutils.strip_path(to_path)) try: self._storage.move(item, to_collection, to_href) diff --git a/radicale/app/put.py b/radicale/app/put.py index b962fbc..786ac00 100644 --- a/radicale/app/put.py +++ b/radicale/app/put.py @@ -201,8 +201,9 @@ class ApplicationPutMixin: prepared_item, = prepared_items if (item and item.uid != prepared_item.uid or not item and parent_item.has_uid(prepared_item.uid)): - return self._webdav_error_response("%s:no-uid-conflict" % ( - "C" if tag == "VCALENDAR" else "CR")) + return self._webdav_error_response( + client.CONFLICT, "%s:no-uid-conflict" % ( + "C" if tag == "VCALENDAR" else "CR")) href = posixpath.basename(pathutils.strip_path(path)) try: