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 dropbox import client, session, rest
|
||||||
from conf import dropbox_access_key, dropbox_secret_key
|
from conf import dropbox_access_key, dropbox_secret_key
|
||||||
from webnotes.utils.backups import new_backup
|
from webnotes.utils.backups import new_backup
|
||||||
|
found = False
|
||||||
if not webnotes.conn:
|
if not webnotes.conn:
|
||||||
webnotes.connect()
|
webnotes.connect()
|
||||||
|
|
||||||
@ -81,15 +82,14 @@ def backup_to_dropbox():
|
|||||||
upload_file_to_dropbox(filename, "database", dropbox_client)
|
upload_file_to_dropbox(filename, "database", dropbox_client)
|
||||||
|
|
||||||
response = dropbox_client.metadata("/files")
|
response = dropbox_client.metadata("/files")
|
||||||
|
|
||||||
# upload files to files folder
|
# upload files to files folder
|
||||||
filename = os.path.join(get_base_path(), "public", "files")
|
path = os.path.join(get_base_path(), "public", "files")
|
||||||
for filename in os.listdir(filename):
|
for files in os.listdir(path):
|
||||||
found = False
|
filename = path + "/" + files
|
||||||
for file_metadata in response["contents"]:
|
for file_metadata in response["contents"]:
|
||||||
if filename==os.path.basename(file_metadata["path"]):
|
if os.path.basename(filename)==os.path.basename(file_metadata["path"]) and os.stat(filename).st_size==int(file_metadata["bytes"]):
|
||||||
if os.stat(filename).st_size==file_metadata["bytes"]:
|
|
||||||
found=True
|
found=True
|
||||||
|
break
|
||||||
|
|
||||||
if not found:
|
if not found:
|
||||||
upload_file_to_dropbox(os.path.join(get_base_path(),"public", "files", filename), "files", dropbox_client)
|
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