Made content_type_extra optional for TemporaryUploadedFile and MemoryUploadedFile.

This provides better backwards compatibility for those constructing these
objects manually.

Refs #13721.
This commit is contained in:
Dmitro 2014-02-18 13:25:39 +02:00 committed by Tim Graham
parent 621c5cf4a5
commit d3e33fff12
1 changed files with 2 additions and 2 deletions

View File

@ -60,7 +60,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):
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)
@ -89,7 +89,7 @@ class InMemoryUploadedFile(UploadedFile):
"""
A file uploaded into memory (i.e. stream-to-memory).
"""
def __init__(self, file, field_name, name, content_type, size, charset, content_type_extra):
def __init__(self, file, field_name, name, content_type, size, charset, content_type_extra=None):
super(InMemoryUploadedFile, self).__init__(file, name, content_type, size, charset, content_type_extra)
self.field_name = field_name