1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #29689 -- Improved performance of FileSystemStorage.listdir() and FilePathField with os.scandir().

This commit is contained in:
Federico Bond
2018-08-19 20:21:57 -03:00
committed by Tim Graham
parent 371ece2f06
commit a0ca4b5694
3 changed files with 19 additions and 19 deletions

View File

@@ -39,11 +39,11 @@ class PathNotImplementedStorage(storage.Storage):
def listdir(self, path):
path = self._path(path)
directories, files = [], []
for entry in os.listdir(path):
if os.path.isdir(os.path.join(path, entry)):
directories.append(entry)
for entry in os.scandir(path):
if entry.is_dir():
directories.append(entry.name)
else:
files.append(entry)
files.append(entry.name)
return directories, files
def delete(self, name):