FileStorage-rf: Why does 'close' call 'open'?
|Reported by:||magneto||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Just got the new FileStorage re-factor, ran a battery of little tests on a site of mine and got this very strange backtrace when trying to delete a file
and YES, there is a signal that does some fancy things with the original file location (likes moves is somewhere rather then really deleting it)
so the file is really 'not' in the original location anymore, but it does seems strange to me that the Field would bounce all the way down to OPEN a file it wants CLOSED
File " assets/views.py" in simple_asset_delete 597. asset.delete() File " assets/models.py" in delete 538. super(Asset, self).delete() File " django/db/models/base.py" in delete 429. delete_objects(seen_objs) File " django/db/models/query.py" in delete_objects 846. signals.post_delete.send(sender=cls, instance=instance) File " django/dispatch/dispatcher.py" in send 133. response = receiver(signal=self, sender=sender, **named) File " django/db/models/fields/files.py" in delete_file 208. file.delete(save=False) File " django/db/models/fields/files.py" in delete 291. super(ImageFieldFile, self).delete(save) File " django/db/models/fields/files.py" in delete 83. self.close() File " django/core/files/base.py" in close 147. self.file.close() File " django/db/models/fields/files.py" in _get_file 45. self._file = self.storage.open(self.name, 'rb') File " django/core/files/storage.py" in open 27. file = self._open(name, mode) File " django/core/files/storage.py" in _open 140. return File(open(self.path(name), mode)) Exception Type: IOError at /delete/asset/86263/ Exception Value: [Errno 2] No such file or directory: u'86/862/86263/mfrohne_2941966_01'
Change History (10)
comment:1 Changed 8 years ago by
|Component:||Core framework → File uploads/storage|
|Patch needs improvement:||unset|
|Triage Stage:||Unreviewed → Accepted|