1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Applied optimizations to template.utils.get_app_template_dirs().

This commit is contained in:
sobolevn 2024-07-20 09:56:22 +03:00 committed by Sarah Boyce
parent 1029a4694e
commit 2ff917fd06

View File

@ -102,10 +102,9 @@ def get_app_template_dirs(dirname):
dirname is the name of the subdirectory containing templates inside dirname is the name of the subdirectory containing templates inside
installed applications. installed applications.
""" """
template_dirs = [
Path(app_config.path) / dirname
for app_config in apps.get_app_configs()
if app_config.path and (Path(app_config.path) / dirname).is_dir()
]
# Immutable return value because it will be cached and shared by callers. # Immutable return value because it will be cached and shared by callers.
return tuple(template_dirs) return tuple(
path
for app_config in apps.get_app_configs()
if app_config.path and (path := Path(app_config.path) / dirname).is_dir()
)