NamedTemporaryFile is missing the delete argument
|Reported by:||LvanderRee||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I am developing under Linux, while my test server is running Windows, which made me aware of the following error.
I wrote the following piece of code:
from django.core.files.temp import NamedTemporaryFile
I looked at the code in the django.core.files.temp module, and see it makes a distinction between Windows and other systems:
However, according to http://docs.python.org/library/tempfile.html#tempfile.NamedTemporaryFile NamedTemporaryFile should be able to handle delete as well!
A solution would be to define NamedTemporaryFile as follows:
def init(self, kwargs):
kwargs.pop('delete', True) # TODO: handle this delete flag
But I haven't thought about how to handle the delete argument.