#35669: Improve `RuntimeError: Max post-process passes exceeded.` error
-------------------------------------+-------------------------------------
     Reporter:  Michael              |                    Owner:  (none)
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  contrib.staticfiles  |                  Version:  5.1
     Severity:  Normal               |               Resolution:
     Keywords:  collect static       |             Triage Stage:  Accepted
  errors                             |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

 * stage:  Unreviewed => Accepted
 * type:  New feature => Cleanup/optimization

Comment:

 Adding the suggestion as a diff
 {{{#!diff
 diff --git a/django/contrib/staticfiles/storage.py
 b/django/contrib/staticfiles/storage.py
 index 04a5edbd30..5c41fd6828 100644
 --- a/django/contrib/staticfiles/storage.py
 +++ b/django/contrib/staticfiles/storage.py
 @@ -309,7 +309,7 @@ class HashedFilesMixin:

          paths = {path: paths[path] for path in adjustable_paths}
          substitutions = False
 -
 +        unresolved_paths = []
          for i in range(self.max_post_process_passes):
              substitutions = False
              for name, hashed_name, processed, subst in
 self._post_process(
 @@ -318,12 +318,15 @@ class HashedFilesMixin:
                  # Overwrite since hashed_name may be newer.
                  processed_adjustable_paths[name] = (name, hashed_name,
 processed)
                  substitutions = substitutions or subst
 +                if subst and i == self.max_post_process_passes - 1:
 +                    unresolved_paths.append(name)

              if not substitutions:
                  break

          if substitutions:
 -            yield "All", None, RuntimeError("Max post-process passes
 exceeded.")
 +            problem_paths_str = ", ".join(unresolved_paths) if
 unresolved_paths else "All"
 +            yield problem_paths_str, None, RuntimeError("Max post-process
 passes exceeded.")

          # Store the processed paths
          self.hashed_files.update(hashed_files)
 }}}

 Appreciate clear error messages so sounds good to me
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35669#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107019145c33346-1cfc41de-7b0b-415c-9d43-78c5c8bfe120-000000%40eu-central-1.amazonses.com.

Reply via email to