Code

Changes between Version 1 and Version 2 of NamedTemporaryFile


Ignore:
Timestamp:
09/19/13 23:00:22 (10 months ago)
Author:
marfire
Comment:

Updated in light of #18744

Legend:

Unmodified
Added
Removed
Modified
  • NamedTemporaryFile

    v1 v2  
    22== NamedTemporaryFile == 
    33 
    4 The NamedTemporaryFile module provides a handle on a temporary file that can be re-opened on any platform. For most platforms, this is just a thin layer over the standard Python tempfile.TemporaryFile class, but MS Windows users are given a custom class with similar properties. This is needed because in Windows NT, the default implementation of NamedTemporaryFile uses the O_TEMPORARY flag, and thus [http://mail.python.org/pipermail/python-list/2005-December/359474.html cannot be reopened]. 
     4NamedTemporaryFile is based on Python's [http://docs.python.org/2.7/library/tempfile.html#tempfile.NamedTemporaryFile 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). 
    55 
    6 It accepts the same parameters as its python counterpart.  
    7  
    8 {{{ 
    9 NamedTemporaryFile(mode='w+b', bufsize=-1, suffix='', prefix='', dir=None) 
    10 }}} 
     6NamedTemporaryFile 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.