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:51:48 -0400
commitb4bb2ad13d178dd2db484c7721fd47aa3d285908 (patch)
treeea25de5130a0c995de3e9ec4060a9e10cad948ef /django
parentf49cfb76c7b24a4fa5f8ac36dfa0a82ab66336c5 (diff)
[1.9.x] Fixed #26297 -- Fixed `collectstatic --clear` crash if storage doesn't implement path().
Backport of 28bcff82c5ed4694f4761c303294ffafbd7096ce from master
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 e6b6198952..793c211f42 100644
--- a/django/contrib/staticfiles/management/commands/collectstatic.py
+++ b/django/contrib/staticfiles/management/commands/collectstatic.py
@@ -218,12 +218,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))