Added an option to disable check in case WebDAV server is not support it

This commit is contained in:
Evgeny Ezhov 2019-11-27 16:15:21 +03:00
parent 64bbd967bc
commit dc7d908462
3 changed files with 6 additions and 3 deletions

View file

@ -34,6 +34,7 @@ Release Notes
* Added Docker Web DAV for CI * Added Docker Web DAV for CI
* Changed HEAD to GET method for 'check' request due of not all servers support HEAD by request of https://github.com/danieleTrimarchi * Changed HEAD to GET method for 'check' request due of not all servers support HEAD by request of https://github.com/danieleTrimarchi
* Removed a costy is_dir-check on obvious directories to speed up a pull by https://github.com/jolly-jump * Removed a costy is_dir-check on obvious directories to speed up a pull by https://github.com/jolly-jump
* Added an option to disable check in case WebDAV server is not support it by request of https://github.com/dzhuang
**Version 0.12 - 21.06.2019** **Version 0.12 - 21.06.2019**
* Added depth argument in copy method in client.py by https://github.com/JesperHakansson * Added depth argument in copy method in client.py by https://github.com/JesperHakansson

View file

@ -274,11 +274,13 @@ class Client(object):
:return: True if resource is exist or False otherwise :return: True if resource is exist or False otherwise
""" """
if not self.webdav.do_check: if self.webdav.disable_check:
return True return True
urn = Urn(remote_path) urn = Urn(remote_path)
try: try:
response = self.execute_request(action='check', path=urn.quote()) response = self.execute_request(action='check', path=urn.quote())
except RemoteResourceNotFound:
return False
except ResponseErrorCode: except ResponseErrorCode:
return False return False

View file

@ -22,7 +22,7 @@ class WebDAVSettings(ConnectionSettings):
ns = "webdav:" ns = "webdav:"
prefix = "webdav_" prefix = "webdav_"
keys = {'hostname', 'login', 'password', 'token', 'root', 'cert_path', 'key_path', 'recv_speed', 'send_speed', keys = {'hostname', 'login', 'password', 'token', 'root', 'cert_path', 'key_path', 'recv_speed', 'send_speed',
'verbose', 'do_check'} 'verbose', 'disable_check'}
hostname = None hostname = None
login = None login = None
@ -34,7 +34,7 @@ class WebDAVSettings(ConnectionSettings):
recv_speed = None recv_speed = None
send_speed = None send_speed = None
verbose = None verbose = None
do_check = False disable_check = False
def __init__(self, options): def __init__(self, options):