From cd88faa62837cef226508d5aa915056dbf934823 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sat, 11 Jun 2016 17:45:11 -0700 Subject: [PATCH] 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. --- django/core/files/uploadedfile.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/django/core/files/uploadedfile.py b/django/core/files/uploadedfile.py index 156c35a1ed..6f71fc3b95 100644 --- a/django/core/files/uploadedfile.py +++ b/django/core/files/uploadedfile.py @@ -61,10 +61,7 @@ class TemporaryUploadedFile(UploadedFile): A file uploaded to a temporary location (i.e. stream-to-disk). """ 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) - else: - file = tempfile.NamedTemporaryFile(suffix='.upload') + file = tempfile.NamedTemporaryFile(suffix='.upload', dir=settings.FILE_UPLOAD_TEMP_DIR) super(TemporaryUploadedFile, self).__init__(file, name, content_type, size, charset, content_type_extra) def temporary_file_path(self):