Remove the upload filesize limit which is a remnant of using PyCurl
This commit is contained in:
parent
17fae10abc
commit
f63a7dc48e
2 changed files with 1 additions and 21 deletions
|
@ -83,9 +83,6 @@ class Client(object):
|
||||||
# path to root directory of WebDAV
|
# path to root directory of WebDAV
|
||||||
root = '/'
|
root = '/'
|
||||||
|
|
||||||
# Max size of file for uploading
|
|
||||||
large_size = 2 * 1024 * 1024 * 1024
|
|
||||||
|
|
||||||
# request timeout in seconds
|
# request timeout in seconds
|
||||||
timeout = 30
|
timeout = 30
|
||||||
|
|
||||||
|
@ -475,11 +472,7 @@ class Client(object):
|
||||||
raise RemoteParentNotFound(urn.path())
|
raise RemoteParentNotFound(urn.path())
|
||||||
|
|
||||||
with open(local_path, "rb") as local_file:
|
with open(local_path, "rb") as local_file:
|
||||||
file_size = os.path.getsize(local_path)
|
self.execute_request(action='upload', path=urn.quote(), data=local_file)
|
||||||
if file_size > self.large_size:
|
|
||||||
raise ResourceTooBig(path=local_path, size=file_size, max_size=self.large_size)
|
|
||||||
|
|
||||||
self.execute_request(action='upload', path=urn.quote(), data=local_file)
|
|
||||||
|
|
||||||
def upload_sync(self, remote_path, local_path, callback=None):
|
def upload_sync(self, remote_path, local_path, callback=None):
|
||||||
"""Uploads resource to remote path on WebDAV server synchronously.
|
"""Uploads resource to remote path on WebDAV server synchronously.
|
||||||
|
|
|
@ -49,19 +49,6 @@ class RemoteParentNotFound(NotFound):
|
||||||
return "Remote parent for: {path} not found".format(path=self.path)
|
return "Remote parent for: {path} not found".format(path=self.path)
|
||||||
|
|
||||||
|
|
||||||
class ResourceTooBig(WebDavException):
|
|
||||||
def __init__(self, path, size, max_size):
|
|
||||||
self.path = path
|
|
||||||
self.size = size
|
|
||||||
self.max_size = max_size
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return "Resource {path} is too big, it should be less then {max_size} but actually: {size}".format(
|
|
||||||
path=self.path,
|
|
||||||
max_size=self.max_size,
|
|
||||||
size=self.size)
|
|
||||||
|
|
||||||
|
|
||||||
class MethodNotSupported(WebDavException):
|
class MethodNotSupported(WebDavException):
|
||||||
def __init__(self, name, server):
|
def __init__(self, name, server):
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
Loading…
Add table
Reference in a new issue