Skip to content

Commit

Permalink
Explicitly close a file in the collectstatic management command.
Browse files Browse the repository at this point in the history
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16525 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
alex committed Jul 8, 2011
1 parent 68d18b8 commit 319b0cf
Showing 1 changed file with 5 additions and 2 deletions.
@@ -1,3 +1,5 @@
from __future__ import with_statement

import os import os
import sys import sys
from optparse import make_option from optparse import make_option
Expand All @@ -9,6 +11,7 @@


from django.contrib.staticfiles import finders from django.contrib.staticfiles import finders



class Command(NoArgsCommand): class Command(NoArgsCommand):
""" """
Command that allows to copy or symlink media files from different Command that allows to copy or symlink media files from different
Expand Down Expand Up @@ -236,7 +239,7 @@ def copy_file(self, path, prefixed_path, source_storage):
os.makedirs(os.path.dirname(full_path)) os.makedirs(os.path.dirname(full_path))
except OSError: except OSError:
pass pass
source_file = source_storage.open(path) with source_storage.open(path) as source_file:
self.storage.save(prefixed_path, source_file) self.storage.save(prefixed_path, source_file)
if not prefixed_path in self.copied_files: if not prefixed_path in self.copied_files:
self.copied_files.append(prefixed_path) self.copied_files.append(prefixed_path)

0 comments on commit 319b0cf

Please sign in to comment.