Add log messages in DropboxService
This commit is contained in:
parent
36226186a0
commit
94ffac4984
@ -64,16 +64,21 @@ class DropboxService(StorageServiceInterface):
|
||||
:param file: bytes representation of the file
|
||||
:return: Whether file was successfully uploaded
|
||||
"""
|
||||
identifier = filename.strip('.jpg')
|
||||
print("DropboxService: Trying to update file with identifier ", identifier)
|
||||
i = 0
|
||||
while True:
|
||||
try:
|
||||
dbx = dropbox.Dropbox(settings.DROPBOX_OAUTH2_ACCESS_TOKEN)
|
||||
dbx.files_get_metadata(filename + '_' + str(i))
|
||||
print("DropboxService: Checking if version %s exists".format(identifier + '_' + str(i) + '.jpg'))
|
||||
dbx.files_get_metadata(identifier + '_' + str(i) + '.jpg')
|
||||
i = i + 1
|
||||
except:
|
||||
print("DropboxService: Version %s exists".format(identifier + '_' + str(i) + '.jpg'))
|
||||
break
|
||||
|
||||
return DropboxService.create_file(filename + '_' + str(i), file)
|
||||
print("DropboxService: Creating new version %s".format(identifier + '_' + str(i) + '.jpg'))
|
||||
return DropboxService.create_file(identifier + '_' + str(i) + '.jpg', file)
|
||||
|
||||
@staticmethod
|
||||
def delete_file(filename: str) -> bool:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user