Added comment for wagtailimages get_upload_to

pull/1464/head
Karl Hobley 2015-07-01 16:57:23 +01:00
rodzic 60e2d81052
commit b2f862d1d4
1 zmienionych plików z 2 dodań i 0 usunięć

Wyświetl plik

@ -49,6 +49,8 @@ def get_upload_to(instance, filename):
# replace non-ascii characters in filename with _ , to sidestep issues with filesystem encoding
filename = "".join((i if ord(i) < 128 else '_') for i in unidecode(filename))
# Truncate filename so it fits in the 100 character limit
# https://code.djangoproject.com/ticket/9893
while len(os.path.join(folder_name, filename)) >= 95:
prefix, dot, extension = filename.rpartition('.')
filename = prefix[:-1] + dot + extension