Undocumented
Class |
|
This class implements parsing of form data for Werkzeug. By itself it can parse multipart and url encoded form data. It can be subclassed and extended but for most mimetypes it is a better idea to use the untouched stream and expose it as separate attributes on a request object. |
Class |
|
Undocumented |
Class |
|
Undocumented |
Function | default |
Undocumented |
Function | exhaust |
Helper decorator for methods that exhausts the stream on return. |
Function | parse |
Parse the form data in the environ and return it as tuple in the form ``(stream, form, files)``. You should only call this method if the transport method is `POST`, `PUT`, or `PATCH`. |
Type Variable | F |
Undocumented |
Type Alias | t |
Undocumented |
Function | _exhaust |
Undocumented |
Function | _line |
Removes line ending characters and returns a tuple (`stripped_line`, `is_terminated`). |
t.Optional[ int]
, content_type: t.Optional[ str]
, filename: t.Optional[ str]
, content_length: t.Optional[ int]
= None) -> t.IO[ bytes]
:
(source)
¶
Undocumented
WSGIEnvironment
, stream_factory: t.Optional[ TStreamFactory]
= None, charset: str
= 'utf-8', errors: str
= 'replace', max_form_memory_size: t.Optional[ int]
= None, max_content_length: t.Optional[ int]
= None, cls: t.Optional[ t.Type[ MultiDict]]
= None, silent: bool
= True) -> t_parse_result
:
(source)
¶
Parse the form data in the environ and return it as tuple in the form ``(stream, form, files)``. You should only call this method if the transport method is `POST`, `PUT`, or `PATCH`. If the mimetype of the data transmitted is `multipart/form-data` the files multidict will be filled with `FileStorage` objects. If the mimetype is unknown the input stream is wrapped and returned as first argument, else the stream is empty. This is a shortcut for the common usage of :class:`FormDataParser`. Have a look at :doc:`/request_data` for more details. .. versionadded:: 0.5 The `max_form_memory_size`, `max_content_length` and `cls` parameters were added. .. versionadded:: 0.5.1 The optional `silent` flag was added. :param environ: the WSGI environment to be used for parsing. :param stream_factory: An optional callable that returns a new read and writeable file descriptor. This callable works the same as :meth:`Response._get_file_stream`. :param charset: The character set for URL and url encoded form data. :param errors: The encoding error behavior. :param max_form_memory_size: the maximum number of bytes to be accepted for in-memory stored form data. If the data exceeds the value specified an :exc:`~exceptions.RequestEntityTooLarge` exception is raised. :param max_content_length: If this is provided and the transmitted data is longer than this value an :exc:`~exceptions.RequestEntityTooLarge` exception is raised. :param cls: an optional dict class to use. If this is not specified or `None` the default :class:`MultiDict` is used. :param silent: If set to False parsing errors will not be caught. :return: A tuple in the form ``(stream, form, files)``.