Opened 2 months ago

Closed 8 weeks ago

#28603 closed Cleanup/optimization (fixed)

collectstatic passes all files to post_process(), contrary to code comment

Reported by: Ed Morley Owned by: Ed Morley
Component: contrib.staticfiles Version: master
Severity: Normal Keywords: collectstatic
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In the collectstatic's collect() function (source), there is this comment:

        # Here we check if the storage backend has a post_process
        # method and pass it the list of modified files.

However contrary to that comment,post_process() is actually passed the list of all found files, not just the modified files:
https://github.com/django/django/blob/8f947730ca6a9e3e538a377e7993e17ce3663ee6/django/contrib/staticfiles/management/commands/collectstatic.py#L127

I'm pretty passing all files is necessary, since if only the modified files were passed and someone had changed the storage backend since the last collectstatic run, then the existing files wouldn't have the necessary post processing applied.

As such, I believe it's the comment that's wrong rather than the implementation, but it would be good to have confirmation :-)

Change History (3)

comment:1 Changed 2 months ago by Ed Morley

Has patch: set
Owner: changed from nobody to Ed Morley
Status: newassigned

comment:2 Changed 8 weeks ago by Tim Graham

Triage Stage: UnreviewedReady for checkin

comment:3 Changed 8 weeks ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 2d4ccac:

Fixed #28603 -- Clarified comment in collectstatic's collect().

Note: See TracTickets for help on using tickets.
Back to Top