mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Refs #28909 -- Simplifed code using unpacking generalizations.
This commit is contained in:
committed by
Tim Graham
parent
4fc8fb7dda
commit
8ef8bc0f64
@@ -544,8 +544,7 @@ class CustomStorage(FileSystemStorage):
|
||||
"""
|
||||
Append numbers to duplicate files rather than underscores, like Trac.
|
||||
"""
|
||||
parts = name.split('.')
|
||||
basename, ext = parts[0], parts[1:]
|
||||
basename, *ext = name.split('.')
|
||||
number = 2
|
||||
while self.exists(name):
|
||||
name = '.'.join([basename, str(number)] + ext)
|
||||
|
||||
Reference in New Issue
Block a user