Code


Version 2 (modified by marfire, 10 months ago) (diff)

Updated in light of #18744

NamedTemporaryFile

NamedTemporaryFile is based on Python's function of the same name. Django's version rectifies a problem with the standard implementation whereby the returned temporary file cannot be reopened on Windows. Django's version allows the file to be reopened in the same process on all platforms (though it does not address the more general issue of opening a file for writing and reading in multiple processes in a manner that works across platforms).

NamedTemporaryFile is for Django's internal use, and as of Python 2.6 does not support the full range of keyword arguments available in the standard Python version.