Opened 7 years ago

Closed 7 years 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: dev
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 by Ed Morley, 7 years ago

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

comment:2 by Tim Graham, 7 years ago

Triage Stage: UnreviewedReady for checkin

comment:3 by Tim Graham <timograham@…>, 7 years ago

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