Fix log messages
This commit is contained in:
parent
9a6e2d3ca8
commit
6ad99561e7
@ -70,14 +70,14 @@ class DropboxService(StorageServiceInterface):
|
||||
while True:
|
||||
try:
|
||||
dbx = dropbox.Dropbox(settings.DROPBOX_OAUTH2_ACCESS_TOKEN)
|
||||
print("DropboxService: Checking if version %s exists".format(identifier + '_' + str(i) + '.jpg'))
|
||||
print("DropboxService: Checking if version {} 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'))
|
||||
print("DropboxService: Version {} exists".format(identifier + '_' + str(i) + '.jpg'))
|
||||
break
|
||||
|
||||
print("DropboxService: Creating new version %s".format(identifier + '_' + str(i) + '.jpg'))
|
||||
print("DropboxService: Creating new version {}".format(identifier + '_' + str(i) + '.jpg'))
|
||||
return DropboxService.create_file(identifier + '_' + str(i) + '.jpg', file)
|
||||
|
||||
@staticmethod
|
||||
|
||||
@ -59,14 +59,14 @@ class MinioService(StorageServiceInterface):
|
||||
try:
|
||||
headers = {'Content-Type': 'binary/octet-stream'}
|
||||
i = 0
|
||||
while MinioService.read_file(identifier + '_' + str(i) + '.jpg') is not False:
|
||||
print("MinioService: Version %s exists".format(identifier + '_' + str(i) + '.jpg'))
|
||||
while MinioService.read_file(identifier + '_' + str(i) + '.jpg') is not None:
|
||||
print("MinioService: Version {} exists".format(identifier + '_' + str(i) + '.jpg'))
|
||||
i = i + 1
|
||||
print("MinioService: Creating new version %s".format(identifier + '_' + str(i) + '.jpg'))
|
||||
print("MinioService: Creating new version {}".format(identifier + '_' + str(i) + '.jpg'))
|
||||
url = settings.AWS_HOST + identifier + '_' + str(i) + '.jpg'
|
||||
r = requests.put(url, data=file, headers=headers)
|
||||
if r.status_code == 200:
|
||||
print("Successfully uploaded a new version with filename %s!".format(identifier + '_' + str(i) + '.jpg'))
|
||||
print("Successfully uploaded a new version with filename {}!".format(identifier + '_' + str(i) + '.jpg'))
|
||||
else:
|
||||
print("Something went wrong while updating")
|
||||
except:
|
||||
|
||||
@ -78,15 +78,15 @@ class MongoDBService:
|
||||
|
||||
i = 0
|
||||
while MongoDBService.getSingle(identifier + '_' + str(i)) is not None:
|
||||
print("MongoDBService: Version %s exists".format(identifier + '_' + str(i)))
|
||||
print("MongoDBService: Version {} exists".format(identifier + '_' + str(i)))
|
||||
i = i + 1
|
||||
|
||||
if i == 0:
|
||||
print("MongoDBService: Creating new version with identifier %s".format(identifier + '_' + str(i)))
|
||||
print("MongoDBService: Creating new version with identifier {}".format(identifier + '_' + str(i)))
|
||||
MongoDBService.createSingle(resp, identifier + '_' + str(i), decoded_image)
|
||||
else:
|
||||
resp = MongoDBService.getSingle(identifier + '_' + str(i - 1))
|
||||
print("MongoDBService: Creating new version with identifier %s".format(identifier + '_' + str(i - 1)))
|
||||
print("MongoDBService: Creating new version with identifier {}".format(identifier + '_' + str(i - 1)))
|
||||
MongoDBService.createSingle(resp, identifier + '_' + str(i), decoded_image)
|
||||
|
||||
return True
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user