Rename _write_xml_content to _xml_response

This commit is contained in:
Unrud 2020-09-14 21:17:18 +02:00
parent 80e8750c8a
commit 42ad18bc84
5 changed files with 6 additions and 7 deletions

View File

@ -345,7 +345,7 @@ class Application(
xmlutils.pretty_xml(xml_content)) xmlutils.pretty_xml(xml_content))
return xml_content return xml_content
def _write_xml_content(self, xml_content): def _xml_response(self, xml_content):
if logger.isEnabledFor(logging.DEBUG): if logger.isEnabledFor(logging.DEBUG):
logger.debug("Response content:\n%s", logger.debug("Response content:\n%s",
xmlutils.pretty_xml(xml_content)) xmlutils.pretty_xml(xml_content))
@ -357,7 +357,7 @@ class Application(
def _webdav_error_response(self, status, human_tag): 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._xml_response(xmlutils.webdav_error(human_tag))
return status, headers, content return status, headers, content

View File

@ -68,4 +68,4 @@ class ApplicationDeleteMixin:
xml_answer = xml_delete( xml_answer = xml_delete(
base_prefix, path, item.collection, item.href) base_prefix, path, item.collection, item.href)
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._xml_response(xml_answer)

View File

@ -374,4 +374,4 @@ class ApplicationPropfindMixin:
self._encoding) self._encoding)
if status == client.FORBIDDEN and xml_answer is None: if status == client.FORBIDDEN and xml_answer is None:
return httputils.NOT_ALLOWED return httputils.NOT_ALLOWED
return status, headers, self._write_xml_content(xml_answer) return status, headers, self._xml_response(xml_answer)

View File

@ -116,5 +116,4 @@ class ApplicationProppatchMixin:
logger.warning( logger.warning(
"Bad PROPPATCH request on %r: %s", path, e, exc_info=True) "Bad PROPPATCH request on %r: %s", path, e, exc_info=True)
return httputils.BAD_REQUEST return httputils.BAD_REQUEST
return (client.MULTI_STATUS, headers, return client.MULTI_STATUS, headers, self._xml_response(xml_answer)
self._write_xml_content(xml_answer))

View File

@ -290,4 +290,4 @@ class ApplicationReportMixin:
logger.warning( logger.warning(
"Bad REPORT request on %r: %s", path, e, exc_info=True) "Bad REPORT request on %r: %s", path, e, exc_info=True)
return httputils.BAD_REQUEST return httputils.BAD_REQUEST
return (status, headers, self._write_xml_content(xml_answer)) return status, headers, self._xml_response(xml_answer)