class documentation

class MultiPartParser: (source)

View In Hierarchy

A rfc2388 multipart/form-data parser. ``MultiValueDict.parse()`` reads the input stream in ``chunk_size`` chunks and returns a tuple of ``(MultiValueDict(POST), MultiValueDict(FILES))``.

Method __init__ Initialize the MultiPartParser object.
Method handle_file_complete Handle all the signaling that takes place when a file is complete.
Method parse Undocumented
Method sanitize_file_name Sanitize the filename of an upload.
Class Variable boundary_re Undocumented
Method _close_files Undocumented
Method _parse Parse the POST data and break it into a FILES MultiValueDict and a POST MultiValueDict.
Instance Variable _boundary Undocumented
Instance Variable _chunk_size Undocumented
Instance Variable _content_length Undocumented
Instance Variable _encoding Undocumented
Instance Variable _files Undocumented
Instance Variable _input_data Undocumented
Instance Variable _meta Undocumented
Instance Variable _post Undocumented
Instance Variable _upload_handlers Undocumented
def __init__(self, META, input_data, upload_handlers, encoding=None): (source)

Initialize the MultiPartParser object. :META: The standard ``META`` dictionary in Django request objects. :input_data: The raw post data, as a file-like object. :upload_handlers: A list of UploadHandler instances that perform operations on the uploaded data. :encoding: The encoding with which to treat the incoming data.

def handle_file_complete(self, old_field_name, counters): (source)

Handle all the signaling that takes place when a file is complete.

def parse(self): (source)

Undocumented

def sanitize_file_name(self, file_name): (source)

Sanitize the filename of an upload. Remove all possible path separators, even though that might remove more than actually required by the target system. Filenames that could potentially cause problems (current/parent dir) are also discarded. It should be noted that this function could still return a "filepath" like "C:some_file.txt" which is handled later on by the storage layer. So while this function does sanitize filenames to some extent, the resulting filename should still be considered as untrusted user input.

boundary_re = (source)

Undocumented

def _close_files(self): (source)

Undocumented

def _parse(self): (source)

Parse the POST data and break it into a FILES MultiValueDict and a POST MultiValueDict. Return a tuple containing the POST and FILES dictionary, respectively.

_boundary = (source)

Undocumented

_chunk_size = (source)

Undocumented

_content_length = (source)

Undocumented

_encoding = (source)

Undocumented

Undocumented

_input_data = (source)

Undocumented

Undocumented

Undocumented

_upload_handlers = (source)

Undocumented