summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-03-14 05:17:05 +0200
committerTim Graham <timograham@gmail.com>2016-03-17 09:49:57 -0400
commit28bcff82c5ed4694f4761c303294ffafbd7096ce (patch)
tree3cf2a2b00766d1e368c7c61e2732aec5f42491af /django
parentecb59cc6579402b68ddfd4499bf30edacf5963be (diff)
Fixed #26297 -- Fixed `collectstatic --clear` crash if storage doesn't implement path().
Diffstat (limited to 'django')
-rw-r--r--django/contrib/staticfiles/management/commands/collectstatic.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/django/contrib/staticfiles/management/commands/collectstatic.py b/django/contrib/staticfiles/management/commands/collectstatic.py
index 60c4e7cd6d..2170647433 100644
--- a/django/contrib/staticfiles/management/commands/collectstatic.py
+++ b/django/contrib/staticfiles/management/commands/collectstatic.py
@@ -221,12 +221,16 @@ class Command(BaseCommand):
smart_text(fpath), level=1)
else:
self.log("Deleting '%s'" % smart_text(fpath), level=1)
- full_path = self.storage.path(fpath)
- if not os.path.exists(full_path) and os.path.lexists(full_path):
- # Delete broken symlinks
- os.unlink(full_path)
- else:
+ try:
+ full_path = self.storage.path(fpath)
+ except NotImplementedError:
self.storage.delete(fpath)
+ else:
+ if not os.path.exists(full_path) and os.path.lexists(full_path):
+ # Delete broken symlinks
+ os.unlink(full_path)
+ else:
+ self.storage.delete(fpath)
for d in dirs:
self.clear_dir(os.path.join(path, d))