summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2012-03-01 23:03:46 +0000
committerJannis Leidel <jannis@leidel.info>2012-03-01 23:03:46 +0000
commit523d6167d6075eb3b9cb3aef71feb940ea0be5a3 (patch)
treea182fe726c56c50a8c43899db8f6975b64282f5e /django
parentdad3e552349a708f32f492ca0cbc398b7b075de7 (diff)
[1.3.X] Fixed #17737 -- Stopped the collectstatic management command from copying the wrong file in repeated runs. Thanks, pigletto.
Backport from trunk (r17612). git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.3.X@17613 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/contrib/staticfiles/management/commands/collectstatic.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/django/contrib/staticfiles/management/commands/collectstatic.py b/django/contrib/staticfiles/management/commands/collectstatic.py
index 24b29e4556..d8aed40383 100644
--- a/django/contrib/staticfiles/management/commands/collectstatic.py
+++ b/django/contrib/staticfiles/management/commands/collectstatic.py
@@ -76,6 +76,7 @@ Type 'yes' to continue, or 'no' to cancel: """)
if confirm != 'yes':
raise CommandError("Collecting static files cancelled.")
+ processed_files = []
for finder in finders.get_finders():
for path, storage in finder.list(ignore_patterns):
# Prefix the relative path if the source storage contains it
@@ -83,10 +84,13 @@ Type 'yes' to continue, or 'no' to cancel: """)
prefixed_path = os.path.join(storage.prefix, path)
else:
prefixed_path = path
+ if prefixed_path in processed_files:
+ continue
if symlink:
self.link_file(path, prefixed_path, storage, **options)
else:
self.copy_file(path, prefixed_path, storage, **options)
+ processed_files.append(prefixed_path)
actual_count = len(self.copied_files) + len(self.symlinked_files)
unmodified_count = len(self.unmodified_files)
@@ -196,9 +200,7 @@ Type 'yes' to continue, or 'no' to cancel: """)
os.makedirs(os.path.dirname(full_path))
except OSError:
pass
- shutil.copy2(source_path, full_path)
- else:
- source_file = source_storage.open(path)
- self.storage.save(prefixed_path, source_file)
+ source_file = source_storage.open(path)
+ self.storage.save(prefixed_path, source_file)
if not prefixed_path in self.copied_files:
self.copied_files.append(prefixed_path)