[4.0.x] Fixed #33628 -- Ignored directories with empty names in autoreloader check for template changes.
Regression in68357b2ca9
. Backport of62739b6e26
from main.
This commit is contained in:
parent
7700084142
commit
78e553b48a
|
@ -16,7 +16,7 @@ def get_template_directories():
|
||||||
if not isinstance(backend, DjangoTemplates):
|
if not isinstance(backend, DjangoTemplates):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
items.update(Path.cwd() / to_path(dir) for dir in backend.engine.dirs)
|
items.update(Path.cwd() / to_path(dir) for dir in backend.engine.dirs if dir)
|
||||||
|
|
||||||
for loader in backend.engine.template_loaders:
|
for loader in backend.engine.template_loaders:
|
||||||
if not hasattr(loader, "get_dirs"):
|
if not hasattr(loader, "get_dirs"):
|
||||||
|
@ -24,7 +24,7 @@ def get_template_directories():
|
||||||
items.update(
|
items.update(
|
||||||
Path.cwd() / to_path(directory)
|
Path.cwd() / to_path(directory)
|
||||||
for directory in loader.get_dirs()
|
for directory in loader.get_dirs()
|
||||||
if not is_django_path(directory)
|
if directory and not is_django_path(directory)
|
||||||
)
|
)
|
||||||
return items
|
return items
|
||||||
|
|
||||||
|
|
|
@ -4,4 +4,12 @@ Django 3.2.13 release notes
|
||||||
|
|
||||||
*April 11, 2022*
|
*April 11, 2022*
|
||||||
|
|
||||||
Django 3.2.13 fixes two security issues with severity "high" in 3.2.12.
|
Django 3.2.13 fixes two security issues with severity "high" in
|
||||||
|
3.2.12 and a regression in 3.2.4.
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
========
|
||||||
|
|
||||||
|
* Fixed a regression in Django 3.2.4 that caused the auto-reloader to no longer
|
||||||
|
detect changes when the ``DIRS`` option of the ``TEMPLATES`` setting
|
||||||
|
contained an empty string (:ticket:`33628`).
|
||||||
|
|
|
@ -4,10 +4,15 @@ Django 4.0.4 release notes
|
||||||
|
|
||||||
*April 11, 2022*
|
*April 11, 2022*
|
||||||
|
|
||||||
Django 4.0.4 fixes two security issues with severity "high" and a bug in 4.0.3.
|
Django 4.0.4 fixes two security issues with severity "high" and two bugs in
|
||||||
|
4.0.3.
|
||||||
|
|
||||||
Bugfixes
|
Bugfixes
|
||||||
========
|
========
|
||||||
|
|
||||||
* Fixed a regression in Django 4.0 that caused ignoring multiple
|
* Fixed a regression in Django 4.0 that caused ignoring multiple
|
||||||
``FilteredRelation()`` relationships to the same field (:ticket:`33598`).
|
``FilteredRelation()`` relationships to the same field (:ticket:`33598`).
|
||||||
|
|
||||||
|
* Fixed a regression in Django 3.2.4 that caused the auto-reloader to no longer
|
||||||
|
detect changes when the ``DIRS`` option of the ``TEMPLATES`` setting
|
||||||
|
contained an empty string (:ticket:`33628`).
|
||||||
|
|
|
@ -68,6 +68,17 @@ class TemplateReloadTests(SimpleTestCase):
|
||||||
autoreload.reset_loaders()
|
autoreload.reset_loaders()
|
||||||
self.assertEqual(mock_reset.call_count, 2)
|
self.assertEqual(mock_reset.call_count, 2)
|
||||||
|
|
||||||
|
@override_settings(
|
||||||
|
TEMPLATES=[
|
||||||
|
{
|
||||||
|
"DIRS": [""],
|
||||||
|
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||||
|
}
|
||||||
|
]
|
||||||
|
)
|
||||||
|
def test_template_dirs_ignore_empty_path(self):
|
||||||
|
self.assertEqual(autoreload.get_template_directories(), set())
|
||||||
|
|
||||||
@override_settings(
|
@override_settings(
|
||||||
TEMPLATES=[
|
TEMPLATES=[
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue