diff options
author | Manel Clos <manelclos@gmail.com> | 2022-04-09 11:36:26 +0200 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-04-11 08:29:10 +0200 |
commit | 78e553b48a728ba68b427a8108e1247e5bb46048 (patch) | |
tree | 56132ef6c5abc6e1addd04271328a1a0a16ec3e2 | |
parent | 7700084142bf7644274876eae796beaa5e252613 (diff) | |
download | django-78e553b48a728ba68b427a8108e1247e5bb46048.tar.gz |
[4.0.x] Fixed #33628 -- Ignored directories with empty names in autoreloader check for template changes.
Regression in 68357b2ca9e88c40fc00d848799813241be39129.
Backport of 62739b6e2630e37faa68a86a59fad135cc788cd7 from main.
-rw-r--r-- | django/template/autoreload.py | 4 | ||||
-rw-r--r-- | docs/releases/3.2.13.txt | 10 | ||||
-rw-r--r-- | docs/releases/4.0.4.txt | 7 | ||||
-rw-r--r-- | tests/template_tests/test_autoreloader.py | 11 |
4 files changed, 28 insertions, 4 deletions
diff --git a/django/template/autoreload.py b/django/template/autoreload.py index 295433b523..60a9e5db6f 100644 --- a/django/template/autoreload.py +++ b/django/template/autoreload.py @@ -16,7 +16,7 @@ def get_template_directories(): if not isinstance(backend, DjangoTemplates): 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: if not hasattr(loader, "get_dirs"): @@ -24,7 +24,7 @@ def get_template_directories(): items.update( Path.cwd() / to_path(directory) for directory in loader.get_dirs() - if not is_django_path(directory) + if directory and not is_django_path(directory) ) return items diff --git a/docs/releases/3.2.13.txt b/docs/releases/3.2.13.txt index 53de2645c4..c26a969f95 100644 --- a/docs/releases/3.2.13.txt +++ b/docs/releases/3.2.13.txt @@ -4,4 +4,12 @@ Django 3.2.13 release notes *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`). diff --git a/docs/releases/4.0.4.txt b/docs/releases/4.0.4.txt index 67dc19ca94..6873e78900 100644 --- a/docs/releases/4.0.4.txt +++ b/docs/releases/4.0.4.txt @@ -4,10 +4,15 @@ Django 4.0.4 release notes *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 ======== * Fixed a regression in Django 4.0 that caused ignoring multiple ``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`). diff --git a/tests/template_tests/test_autoreloader.py b/tests/template_tests/test_autoreloader.py index a09a11c288..9d16ef65d6 100644 --- a/tests/template_tests/test_autoreloader.py +++ b/tests/template_tests/test_autoreloader.py @@ -71,6 +71,17 @@ class TemplateReloadTests(SimpleTestCase): @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( + TEMPLATES=[ + { "DIRS": [ str(ROOT) + "/absolute_str", "template_tests/relative_str", |