From 528c9af5436814f60e88c9d31c991d72f7ea7fbc Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Mon, 27 Oct 2014 09:35:01 +0100 Subject: [PATCH] Fixed #23717 -- Fixed makemessages crash when STATIC_ROOT=None --- django/core/management/commands/makemessages.py | 2 +- docs/releases/1.7.2.txt | 3 +++ tests/i18n/test_extraction.py | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py index 1383fa8487..4f6cad6832 100644 --- a/django/core/management/commands/makemessages.py +++ b/django/core/management/commands/makemessages.py @@ -372,7 +372,7 @@ class Command(BaseCommand): norm_patterns.append(p) all_files = [] - ignored_roots = [os.path.normpath(p) for p in (settings.MEDIA_ROOT, settings.STATIC_ROOT)] + ignored_roots = [os.path.normpath(p) for p in (settings.MEDIA_ROOT, settings.STATIC_ROOT) if p] for dirpath, dirnames, filenames in os.walk(root, topdown=True, followlinks=self.symlinks): for dirname in dirnames[:]: if (is_ignored(os.path.normpath(os.path.join(dirpath, dirname)), norm_patterns) or diff --git a/docs/releases/1.7.2.txt b/docs/releases/1.7.2.txt index 7a744bf70c..a28a86d551 100644 --- a/docs/releases/1.7.2.txt +++ b/docs/releases/1.7.2.txt @@ -21,3 +21,6 @@ Bugfixes * Prevented :djadmin:`flush` from loading initial data for migrated apps (:ticket:`23699`). + +* Fixed a :djadmin:`makemessages` regression in 1.7.1 when + :setting:`STATIC_ROOT` has the default ``None`` value (:ticket:`23717`). diff --git a/tests/i18n/test_extraction.py b/tests/i18n/test_extraction.py index c0c03ee506..cee3c220c8 100644 --- a/tests/i18n/test_extraction.py +++ b/tests/i18n/test_extraction.py @@ -376,6 +376,14 @@ class JavascriptExtractorTests(ExtractorTests): self.assertMsgId("Static content inside app should be included.", po_contents) self.assertNotMsgId("Content from STATIC_ROOT should not be included", po_contents) + @override_settings(STATIC_ROOT=None, MEDIA_ROOT='') + def test_default_root_settings(self): + """ + Regression test for #23717. + """ + _, po_contents = self._run_makemessages(domain='djangojs') + self.assertMsgId("Static content inside app should be included.", po_contents) + class IgnoredExtractorTests(ExtractorTests):