summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorFrançois Freitag <mail@franek.fr>2020-05-02 19:51:26 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-05-02 20:36:14 +0200
commite0998a460ac15464bcdb048ebc52eae0bb1cbd38 (patch)
treeda1fecda8cacbca4d59f517896dde93e6f0d42d7 /django
parent909b5cd1aaf1e7a2042f53b82bdb429caafdfb86 (diff)
Optimized collectstatic when verbosity is 0.
Avoid the dict lookup and length computation when command is not run in verbose mode.
Diffstat (limited to 'django')
-rw-r--r--django/contrib/staticfiles/management/commands/collectstatic.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/django/contrib/staticfiles/management/commands/collectstatic.py b/django/contrib/staticfiles/management/commands/collectstatic.py
index 252b83987f..9c90fb09b4 100644
--- a/django/contrib/staticfiles/management/commands/collectstatic.py
+++ b/django/contrib/staticfiles/management/commands/collectstatic.py
@@ -185,12 +185,12 @@ class Command(BaseCommand):
raise CommandError("Collecting static files cancelled.")
collected = self.collect()
- modified_count = len(collected['modified'])
- unmodified_count = len(collected['unmodified'])
- post_processed_count = len(collected['post_processed'])
if self.verbosity >= 1:
- summary = (
+ modified_count = len(collected['modified'])
+ unmodified_count = len(collected['unmodified'])
+ post_processed_count = len(collected['post_processed'])
+ return (
"\n%(modified_count)s %(identifier)s %(action)s"
"%(destination)s%(unmodified)s%(post_processed)s."
) % {
@@ -203,7 +203,6 @@ class Command(BaseCommand):
', %s post-processed'
% post_processed_count or ''),
}
- return summary
def log(self, msg, level=2):
"""