summaryrefslogtreecommitdiff
path: root/django/core/files/uploadhandler.py
diff options
context:
space:
mode:
authorBenjamin Kagia <kagia@server.fake>2013-04-19 20:20:23 +0300
committerTim Graham <timograham@gmail.com>2013-07-11 09:11:59 -0400
commitb0953dc91385fb2823294a76d3c99e01c7b7e4ee (patch)
tree86f129ff99ca6f8276e71eb7f811fc28596badc3 /django/core/files/uploadhandler.py
parentecd746191c428866e621b9d13ac90a116b1369dc (diff)
downloaddjango-b0953dc91385fb2823294a76d3c99e01c7b7e4ee.tar.gz
Fixed #13721 -- Added UploadedFile.content_type_extra.
Thanks Waldemar Kornewald and mvschaik for work on the patch.
Diffstat (limited to 'django/core/files/uploadhandler.py')
-rw-r--r--django/core/files/uploadhandler.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/django/core/files/uploadhandler.py b/django/core/files/uploadhandler.py
index f5e95cf2fd..6739b26e0c 100644
--- a/django/core/files/uploadhandler.py
+++ b/django/core/files/uploadhandler.py
@@ -64,6 +64,7 @@ class FileUploadHandler(object):
self.content_type = None
self.content_length = None
self.charset = None
+ self.content_type_extra = None
self.request = request
def handle_raw_input(self, input_data, META, content_length, boundary, encoding=None):
@@ -84,7 +85,7 @@ class FileUploadHandler(object):
"""
pass
- def new_file(self, field_name, file_name, content_type, content_length, charset=None):
+ def new_file(self, field_name, file_name, content_type, content_length, charset=None, content_type_extra=None):
"""
Signal that a new file has been started.
@@ -96,6 +97,7 @@ class FileUploadHandler(object):
self.content_type = content_type
self.content_length = content_length
self.charset = charset
+ self.content_type_extra = content_type_extra
def receive_data_chunk(self, raw_data, start):
"""
@@ -132,7 +134,7 @@ class TemporaryFileUploadHandler(FileUploadHandler):
Create the file object to append to as data is coming in.
"""
super(TemporaryFileUploadHandler, self).new_file(file_name, *args, **kwargs)
- self.file = TemporaryUploadedFile(self.file_name, self.content_type, 0, self.charset)
+ self.file = TemporaryUploadedFile(self.file_name, self.content_type, 0, self.charset, self.content_type_extra)
def receive_data_chunk(self, raw_data, start):
self.file.write(raw_data)
@@ -187,7 +189,8 @@ class MemoryFileUploadHandler(FileUploadHandler):
name = self.file_name,
content_type = self.content_type,
size = file_size,
- charset = self.charset
+ charset = self.charset,
+ content_type_extra = self.content_type_extra
)