dropbox chunked uploader fixed.
This commit is contained in:
parent
09957b61c8
commit
4ff94e389e
@ -64,6 +64,7 @@ def backup_to_dropbox():
|
||||
from dropbox import client, session, rest
|
||||
from conf import dropbox_access_key, dropbox_secret_key
|
||||
from webnotes.utils.backups import new_backup
|
||||
found = False
|
||||
if not webnotes.conn:
|
||||
webnotes.connect()
|
||||
|
||||
@ -81,15 +82,14 @@ def backup_to_dropbox():
|
||||
upload_file_to_dropbox(filename, "database", dropbox_client)
|
||||
|
||||
response = dropbox_client.metadata("/files")
|
||||
|
||||
# upload files to files folder
|
||||
filename = os.path.join(get_base_path(), "public", "files")
|
||||
for filename in os.listdir(filename):
|
||||
found = False
|
||||
path = os.path.join(get_base_path(), "public", "files")
|
||||
for files in os.listdir(path):
|
||||
filename = path + "/" + files
|
||||
for file_metadata in response["contents"]:
|
||||
if filename==os.path.basename(file_metadata["path"]):
|
||||
if os.stat(filename).st_size==file_metadata["bytes"]:
|
||||
found=True
|
||||
if os.path.basename(filename)==os.path.basename(file_metadata["path"]) and os.stat(filename).st_size==int(file_metadata["bytes"]):
|
||||
found=True
|
||||
break
|
||||
|
||||
if not found:
|
||||
upload_file_to_dropbox(os.path.join(get_base_path(),"public", "files", filename), "files", dropbox_client)
|
||||
|
Loading…
x
Reference in New Issue
Block a user