summaryrefslogtreecommitdiff
path: root/django/contrib/staticfiles/management/commands/collectstatic.py
diff options
context:
space:
mode:
authorMads Jensen <mje@inducks.org>2017-03-09 16:17:41 +0100
committerTim Graham <timograham@gmail.com>2017-06-28 14:07:55 -0400
commit550cb3a365dee4edfdd1563224d5304de2a57fda (patch)
treefb532f38774ff7619edd2a4532c3daae1ee0ac5a /django/contrib/staticfiles/management/commands/collectstatic.py
parent43a4835edf32c57eb74c0eb207c276734a34abcf (diff)
Fixed #27818 -- Replaced try/except/pass with contextlib.suppress().
Diffstat (limited to 'django/contrib/staticfiles/management/commands/collectstatic.py')
-rw-r--r--django/contrib/staticfiles/management/commands/collectstatic.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/django/contrib/staticfiles/management/commands/collectstatic.py b/django/contrib/staticfiles/management/commands/collectstatic.py
index e5ae48f9fe..7e81ef19ee 100644
--- a/django/contrib/staticfiles/management/commands/collectstatic.py
+++ b/django/contrib/staticfiles/management/commands/collectstatic.py
@@ -1,5 +1,6 @@
import os
from collections import OrderedDict
+from contextlib import suppress
from django.apps import apps
from django.contrib.staticfiles.finders import get_finders
@@ -312,10 +313,8 @@ class Command(BaseCommand):
else:
self.log("Linking '%s'" % source_path, level=1)
full_path = self.storage.path(prefixed_path)
- try:
+ with suppress(OSError):
os.makedirs(os.path.dirname(full_path))
- except OSError:
- pass
try:
if os.path.lexists(full_path):
os.unlink(full_path)