Cosmetics
This commit is contained in:
parent
d3b90506f5
commit
e63a6e0c85
@ -349,7 +349,7 @@ class Application(
|
|||||||
xml_declaration=True)
|
xml_declaration=True)
|
||||||
return f.getvalue()
|
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."""
|
"""Generate XML error response."""
|
||||||
headers = {"Content-Type": "text/xml; charset=%s" % self._encoding}
|
headers = {"Content-Type": "text/xml; charset=%s" % self._encoding}
|
||||||
content = self._write_xml_content(xmlutils.webdav_error(human_tag))
|
content = self._write_xml_content(xmlutils.webdav_error(human_tag))
|
||||||
|
@ -54,7 +54,8 @@ class ApplicationMkcalendarMixin:
|
|||||||
with self._storage.acquire_lock("w", user):
|
with self._storage.acquire_lock("w", user):
|
||||||
item = next(self._storage.discover(path), None)
|
item = next(self._storage.discover(path), None)
|
||||||
if item:
|
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(
|
parent_path = pathutils.unstrip_path(
|
||||||
posixpath.dirname(pathutils.strip_path(path)), True)
|
posixpath.dirname(pathutils.strip_path(path)), True)
|
||||||
parent_item = next(self._storage.discover(parent_path), None)
|
parent_item = next(self._storage.discover(parent_path), None)
|
||||||
|
@ -76,8 +76,9 @@ class ApplicationMoveMixin:
|
|||||||
not to_item and
|
not to_item and
|
||||||
to_collection.path != item.collection.path and
|
to_collection.path != item.collection.path and
|
||||||
to_collection.has_uid(item.uid)):
|
to_collection.has_uid(item.uid)):
|
||||||
return self._webdav_error_response("%s:no-uid-conflict" % (
|
return self._webdav_error_response(
|
||||||
"C" if tag == "VCALENDAR" else "CR"))
|
client.CONFLICT, "%s:no-uid-conflict" % (
|
||||||
|
"C" if tag == "VCALENDAR" else "CR"))
|
||||||
to_href = posixpath.basename(pathutils.strip_path(to_path))
|
to_href = posixpath.basename(pathutils.strip_path(to_path))
|
||||||
try:
|
try:
|
||||||
self._storage.move(item, to_collection, to_href)
|
self._storage.move(item, to_collection, to_href)
|
||||||
|
@ -201,8 +201,9 @@ class ApplicationPutMixin:
|
|||||||
prepared_item, = prepared_items
|
prepared_item, = prepared_items
|
||||||
if (item and item.uid != prepared_item.uid or
|
if (item and item.uid != prepared_item.uid or
|
||||||
not item and parent_item.has_uid(prepared_item.uid)):
|
not item and parent_item.has_uid(prepared_item.uid)):
|
||||||
return self._webdav_error_response("%s:no-uid-conflict" % (
|
return self._webdav_error_response(
|
||||||
"C" if tag == "VCALENDAR" else "CR"))
|
client.CONFLICT, "%s:no-uid-conflict" % (
|
||||||
|
"C" if tag == "VCALENDAR" else "CR"))
|
||||||
|
|
||||||
href = posixpath.basename(pathutils.strip_path(path))
|
href = posixpath.basename(pathutils.strip_path(path))
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user