Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Stopped the collectstatic management from being wastful with file han…

…dlers. Refs r17519.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17521 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 803de60c088e7a439b5549575e1e3a082ae26d54 1 parent bd13cfa
Jannis Leidel authored February 14, 2012
2  django/contrib/staticfiles/management/commands/collectstatic.py
@@ -107,7 +107,7 @@ def collect(self):
107 107
                     prefixed_path = os.path.join(storage.prefix, path)
108 108
                 else:
109 109
                     prefixed_path = path
110  
-                found_files[prefixed_path] = storage.open(path)
  110
+                found_files[prefixed_path] = (storage, path)
111 111
                 handler(path, prefixed_path, storage)
112 112
 
113 113
         # Here we check if the storage backend has a post_process
3  django/contrib/staticfiles/storage.py
@@ -198,7 +198,8 @@ def post_process(self, paths, dry_run=False, **options):
198 198
 
199 199
             # use the original, local file, not the copied-but-unprocessed
200 200
             # file, which might be somewhere far away, like S3
201  
-            with paths[name] as original_file:
  201
+            storage, path = paths[name]
  202
+            with storage.open(path) as original_file:
202 203
 
203 204
                 # generate the hash with the original content, even for
204 205
                 # adjustable files.
4  docs/ref/contrib/staticfiles.txt
@@ -281,8 +281,8 @@ StaticFilesStorage
281 281
     .. versionadded:: 1.4
282 282
 
283 283
     This method is called by the :djadmin:`collectstatic` management command
284  
-    after each run and gets passed the paths of found files, as well as the
285  
-    command line options.
  284
+    after each run and gets passed the local storages and paths of found
  285
+    files as a dictionary, as well as the command line options.
286 286
 
287 287
     The :class:`~django.contrib.staticfiles.storage.CachedStaticFilesStorage`
288 288
     uses this behind the scenes to replace the paths with their hashed

0 notes on commit 803de60

Please sign in to comment.
Something went wrong with that request. Please try again.