mirror of
https://github.com/django/django.git
synced 2024-12-22 09:05:43 +00:00
Fixed #35669 -- Improved max post-process passes exceeded error message in HashedFilesMixin.
Signed-off-by: SaJH <wogur981208@gmail.com>
This commit is contained in:
parent
2b2a2c0e26
commit
2ff00251f9
@ -308,22 +308,23 @@ class HashedFilesMixin:
|
|||||||
processed_adjustable_paths[name] = (name, hashed_name, processed)
|
processed_adjustable_paths[name] = (name, hashed_name, processed)
|
||||||
|
|
||||||
paths = {path: paths[path] for path in adjustable_paths}
|
paths = {path: paths[path] for path in adjustable_paths}
|
||||||
substitutions = False
|
unresolved_paths = []
|
||||||
|
|
||||||
for i in range(self.max_post_process_passes):
|
for i in range(self.max_post_process_passes):
|
||||||
substitutions = False
|
unresolved_paths = []
|
||||||
for name, hashed_name, processed, subst in self._post_process(
|
for name, hashed_name, processed, subst in self._post_process(
|
||||||
paths, adjustable_paths, hashed_files
|
paths, adjustable_paths, hashed_files
|
||||||
):
|
):
|
||||||
# Overwrite since hashed_name may be newer.
|
# Overwrite since hashed_name may be newer.
|
||||||
processed_adjustable_paths[name] = (name, hashed_name, processed)
|
processed_adjustable_paths[name] = (name, hashed_name, processed)
|
||||||
substitutions = substitutions or subst
|
if subst:
|
||||||
|
unresolved_paths.append(name)
|
||||||
|
|
||||||
if not substitutions:
|
if not unresolved_paths:
|
||||||
break
|
break
|
||||||
|
|
||||||
if substitutions:
|
if unresolved_paths:
|
||||||
yield "All", None, RuntimeError("Max post-process passes exceeded.")
|
problem_paths = ", ".join(sorted(unresolved_paths))
|
||||||
|
yield problem_paths, None, RuntimeError("Max post-process passes exceeded.")
|
||||||
|
|
||||||
# Store the processed paths
|
# Store the processed paths
|
||||||
self.hashed_files.update(hashed_files)
|
self.hashed_files.update(hashed_files)
|
||||||
|
3
tests/staticfiles_tests/project/loop/baz.css
Normal file
3
tests/staticfiles_tests/project/loop/baz.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
body {
|
||||||
|
background-color: #fafafa;
|
||||||
|
}
|
@ -186,7 +186,9 @@ class TestHashedFiles:
|
|||||||
err = StringIO()
|
err = StringIO()
|
||||||
with self.assertRaisesMessage(RuntimeError, "Max post-process passes exceeded"):
|
with self.assertRaisesMessage(RuntimeError, "Max post-process passes exceeded"):
|
||||||
call_command("collectstatic", interactive=False, verbosity=0, stderr=err)
|
call_command("collectstatic", interactive=False, verbosity=0, stderr=err)
|
||||||
self.assertEqual("Post-processing 'All' failed!\n\n", err.getvalue())
|
self.assertEqual(
|
||||||
|
"Post-processing 'bar.css, foo.css' failed!\n\n", err.getvalue()
|
||||||
|
)
|
||||||
self.assertPostCondition()
|
self.assertPostCondition()
|
||||||
|
|
||||||
def test_post_processing(self):
|
def test_post_processing(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user