Fix #1015: broken migration on S3

merge-requests/1042/head
Eliot Berriot 2020-01-28 10:03:50 +01:00
rodzic b48a4cd080
commit f791ba5614
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6B501DFD73514E14
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -19,13 +19,13 @@ def create_attachments(apps, schema_editor):
print('Creating attachments for {} user avatars, this may take a while…'.format(total))
from django.core.files.storage import FileSystemStorage
for i, user in enumerate(qs):
size = None
if isinstance(user.avatar.storage._wrapped, FileSystemStorage):
try:
size = user.avatar.size
except FileNotFoundError:
# can occur when file isn't found on disk or S3
print(" Warning: avatar file wasn't found in storage: {}".format(e.__class__))
size = None
obj_attachment_mapping[user.actor] = Attachment(
file=user.avatar,
size=size,