示例#1
0
 def new_file(self, *args, **kwargs):
     """
     Create the file object to append to as data is coming in.
     """
     super(TemporaryFileUploadHandler, self).new_file(*args, **kwargs)
     self.file = TemporaryUploadedFile(self.file_name, self.content_type, 0,
                                       self.charset,
                                       self.content_type_extra)
示例#2
0
 def new_file(self, *args, **kwargs):
     """
     Create the file object to append to as data is coming in.
     """
     super(TemporaryFileUploadHandler, self).new_file(*args, **kwargs)
     self.file = TemporaryUploadedFile(
         self.file_name, self.content_type, 0, self.charset, self.content_type_extra)
示例#3
0
class TemporaryFileUploadHandler(FileUploadHandler):
    """
    Upload handler that streams data into a temporary file.
    """

    def __init__(self, *args, **kwargs):
        super(TemporaryFileUploadHandler, self).__init__(*args, **kwargs)

    def new_file(self, *args, **kwargs):
        """
        Create the file object to append to as data is coming in.
        """
        super(TemporaryFileUploadHandler, self).new_file(*args, **kwargs)
        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)

    def file_complete(self, file_size):
        self.file.seek(0)
        self.file.size = file_size
        return self.file
示例#4
0
class TemporaryFileUploadHandler(FileUploadHandler):
    """
    Upload handler that streams data into a temporary file.
    """
    def __init__(self, *args, **kwargs):
        super(TemporaryFileUploadHandler, self).__init__(*args, **kwargs)

    def new_file(self, *args, **kwargs):
        """
        Create the file object to append to as data is coming in.
        """
        super(TemporaryFileUploadHandler, self).new_file(*args, **kwargs)
        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)

    def file_complete(self, file_size):
        self.file.seek(0)
        self.file.size = file_size
        return self.file