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:34:01 +0200 |
| commit | bdb92dba0b07e2bac17795f0d515eb9d105addf8 (patch) | |
| tree | 31513b7d214ccedcfb47647837df9cca90d53585 | |
| parent | 70035fb0444ae7c01613374212ca5e3c27c9782c (diff) | |
[3.2.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-- | tests/template_tests/test_autoreloader.py | 11 |
3 files changed, 22 insertions, 3 deletions
diff --git a/django/template/autoreload.py b/django/template/autoreload.py index 18570b5633..be53693e9d 100644 --- a/django/template/autoreload.py +++ b/django/template/autoreload.py @@ -18,7 +18,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'): @@ -26,7 +26,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/tests/template_tests/test_autoreloader.py b/tests/template_tests/test_autoreloader.py index d6ece4cc6d..0a909bfdd3 100644 --- a/tests/template_tests/test_autoreloader.py +++ b/tests/template_tests/test_autoreloader.py @@ -65,6 +65,17 @@ class TemplateReloadTests(SimpleTestCase): 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( TEMPLATES=[{ 'DIRS': [ str(ROOT) + '/absolute_str', |
