Add warning when failing to delete old avatar file

pull/4503/head
Matt Westcott 2018-04-23 14:49:04 +01:00
rodzic ad7bf892eb
commit a98f7dd03a
1 zmienionych plików z 3 dodań i 1 usunięć

Wyświetl plik

@ -1,3 +1,4 @@
import warnings
from itertools import groupby
from operator import itemgetter
@ -436,7 +437,8 @@ class AvatarPreferencesForm(forms.ModelForm):
try:
self._original_avatar.storage.delete(self._original_avatar.name)
except IOError:
pass # failure to delete the old avatar shouldn't prevent us from continuing
# failure to delete the old avatar shouldn't prevent us from continuing
warnings.warn("Failed to delete old avatar file: %s" % self._original_avatar.name)
super().save(commit=commit)
class Meta: