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:
committed by
Tim Graham
parent
371ece2f06
commit
a0ca4b5694
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user