Removed unnecessary check in TemporaryUploadedFile.

If settings.FILE_UPLOAD_TEMP_DIR is the default value of None,
NamedTemporaryFile will work the same as if nothing was passed.
This commit is contained in:
Jon Dufresne 2016-06-11 17:45:11 -07:00 committed by Tim Graham
parent bb7bb379e8
commit cd88faa628
1 changed files with 1 additions and 4 deletions

View File

@ -61,10 +61,7 @@ class TemporaryUploadedFile(UploadedFile):
A file uploaded to a temporary location (i.e. stream-to-disk). A file uploaded to a temporary location (i.e. stream-to-disk).
""" """
def __init__(self, name, content_type, size, charset, content_type_extra=None): def __init__(self, name, content_type, size, charset, content_type_extra=None):
if settings.FILE_UPLOAD_TEMP_DIR: file = tempfile.NamedTemporaryFile(suffix='.upload', dir=settings.FILE_UPLOAD_TEMP_DIR)
file = tempfile.NamedTemporaryFile(suffix='.upload', dir=settings.FILE_UPLOAD_TEMP_DIR)
else:
file = tempfile.NamedTemporaryFile(suffix='.upload')
super(TemporaryUploadedFile, self).__init__(file, name, content_type, size, charset, content_type_extra) super(TemporaryUploadedFile, self).__init__(file, name, content_type, size, charset, content_type_extra)
def temporary_file_path(self): def temporary_file_path(self):