Stopped the collectstatic management from being wastful with file handlers. Refs r17519.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17521 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jannis Leidel 2012-02-14 09:55:09 +00:00
parent bd13cfa917
commit 803de60c08
3 changed files with 5 additions and 4 deletions

View File

@ -107,7 +107,7 @@ class Command(NoArgsCommand):
prefixed_path = os.path.join(storage.prefix, path) prefixed_path = os.path.join(storage.prefix, path)
else: else:
prefixed_path = path prefixed_path = path
found_files[prefixed_path] = storage.open(path) found_files[prefixed_path] = (storage, path)
handler(path, prefixed_path, storage) handler(path, prefixed_path, storage)
# Here we check if the storage backend has a post_process # Here we check if the storage backend has a post_process

View File

@ -198,7 +198,8 @@ class CachedFilesMixin(object):
# use the original, local file, not the copied-but-unprocessed # use the original, local file, not the copied-but-unprocessed
# file, which might be somewhere far away, like S3 # file, which might be somewhere far away, like S3
with paths[name] as original_file: storage, path = paths[name]
with storage.open(path) as original_file:
# generate the hash with the original content, even for # generate the hash with the original content, even for
# adjustable files. # adjustable files.

View File

@ -281,8 +281,8 @@ StaticFilesStorage
.. versionadded:: 1.4 .. versionadded:: 1.4
This method is called by the :djadmin:`collectstatic` management command This method is called by the :djadmin:`collectstatic` management command
after each run and gets passed the paths of found files, as well as the after each run and gets passed the local storages and paths of found
command line options. files as a dictionary, as well as the command line options.
The :class:`~django.contrib.staticfiles.storage.CachedStaticFilesStorage` The :class:`~django.contrib.staticfiles.storage.CachedStaticFilesStorage`
uses this behind the scenes to replace the paths with their hashed uses this behind the scenes to replace the paths with their hashed