mirror of
https://github.com/django/django.git
synced 2025-07-18 18:55:18 +00:00
Fixed #8175: don't open files we're about to close. This was a pesky bug to track down; thanks to charmless for tracking it down.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8637 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
c33aeaa082
commit
8943a857a7
2 changed files with 12 additions and 1 deletions
|
@ -78,7 +78,12 @@ class FieldFile(File):
|
|||
save.alters_data = True
|
||||
|
||||
def delete(self, save=True):
|
||||
self.close()
|
||||
# Only close the file if it's already open, which we know by the
|
||||
# presence of self._file
|
||||
if hasattr(self, '_file'):
|
||||
self.close()
|
||||
del self._file
|
||||
|
||||
self.storage.delete(self.name)
|
||||
|
||||
self._name = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue