Use logger variable
This commit is contained in:
parent
71e5dcf414
commit
c9177e2338
@ -1089,6 +1089,7 @@ def report(base_prefix, path, xml_request, collection):
|
|||||||
Read rfc3253-3.6 for info.
|
Read rfc3253-3.6 for info.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
logger = collection.logger
|
||||||
multistatus = ET.Element(_tag("D", "multistatus"))
|
multistatus = ET.Element(_tag("D", "multistatus"))
|
||||||
if xml_request is None:
|
if xml_request is None:
|
||||||
return client.MULTI_STATUS, multistatus
|
return client.MULTI_STATUS, multistatus
|
||||||
@ -1101,8 +1102,8 @@ def report(base_prefix, path, xml_request, collection):
|
|||||||
# properties, just return an empty result.
|
# properties, just return an empty result.
|
||||||
# InfCloud asks for expand-property reports (even if we don't announce
|
# InfCloud asks for expand-property reports (even if we don't announce
|
||||||
# support for them) and stops working if an error code is returned.
|
# support for them) and stops working if an error code is returned.
|
||||||
collection.logger.warning("Unsupported REPORT method %r on %r "
|
logger.warning("Unsupported REPORT method %r on %r requested",
|
||||||
"requested", root.tag, path)
|
root.tag, path)
|
||||||
return client.MULTI_STATUS, multistatus
|
return client.MULTI_STATUS, multistatus
|
||||||
prop_element = root.find(_tag("D", "prop"))
|
prop_element = root.find(_tag("D", "prop"))
|
||||||
props = (
|
props = (
|
||||||
@ -1120,21 +1121,20 @@ def report(base_prefix, path, xml_request, collection):
|
|||||||
if (href_path + "/").startswith(base_prefix + "/"):
|
if (href_path + "/").startswith(base_prefix + "/"):
|
||||||
hreferences.add(href_path[len(base_prefix):])
|
hreferences.add(href_path[len(base_prefix):])
|
||||||
else:
|
else:
|
||||||
collection.logger.warning("Skipping invalid path %r in REPORT "
|
logger.warning("Skipping invalid path %r in REPORT request on "
|
||||||
"request on %r", href_path, path)
|
"%r", href_path, path)
|
||||||
elif root.tag == _tag("D", "sync-collection"):
|
elif root.tag == _tag("D", "sync-collection"):
|
||||||
old_sync_token_element = root.find(_tag("D", "sync-token"))
|
old_sync_token_element = root.find(_tag("D", "sync-token"))
|
||||||
old_sync_token = ""
|
old_sync_token = ""
|
||||||
if old_sync_token_element is not None and old_sync_token_element.text:
|
if old_sync_token_element is not None and old_sync_token_element.text:
|
||||||
old_sync_token = old_sync_token_element.text.strip()
|
old_sync_token = old_sync_token_element.text.strip()
|
||||||
collection.logger.debug("Client provided sync token: %r",
|
logger.debug("Client provided sync token: %r", old_sync_token)
|
||||||
old_sync_token)
|
|
||||||
try:
|
try:
|
||||||
sync_token, names = collection.sync(old_sync_token)
|
sync_token, names = collection.sync(old_sync_token)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
# Invalid sync token
|
# Invalid sync token
|
||||||
collection.logger.warning("Client provided invalid sync token %r: "
|
logger.warning("Client provided invalid sync token %r: %s",
|
||||||
"%s", old_sync_token, e, exc_info=True)
|
old_sync_token, e, exc_info=True)
|
||||||
return (client.PRECONDITION_FAILED,
|
return (client.PRECONDITION_FAILED,
|
||||||
_webdav_error("D", "valid-sync-token"))
|
_webdav_error("D", "valid-sync-token"))
|
||||||
hreferences = ("/" + posixpath.join(collection.path, n) for n in names)
|
hreferences = ("/" + posixpath.join(collection.path, n) for n in names)
|
||||||
@ -1164,9 +1164,8 @@ def report(base_prefix, path, xml_request, collection):
|
|||||||
try:
|
try:
|
||||||
name = name_from_path(hreference, collection)
|
name = name_from_path(hreference, collection)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
collection.logger.warning(
|
logger.warning("Skipping invalid path %r in REPORT request"
|
||||||
"Skipping invalid path %r in REPORT request on %r: %s",
|
" on %r: %s", hreference, path, e)
|
||||||
hreference, path, e)
|
|
||||||
response = _item_response(base_prefix, hreference,
|
response = _item_response(base_prefix, hreference,
|
||||||
found_item=False)
|
found_item=False)
|
||||||
multistatus.append(response)
|
multistatus.append(response)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user