OpenQuizz
Une application de gestion des contenus pédagogiques
werkzeug.formparser Namespace Reference

Data Structures

class  FormDataParser
 
class  MultiPartParser
 

Functions

def default_stream_factory (total_content_length, filename, content_type, content_length=None)
 
def parse_form_data (environ, stream_factory=None, charset="utf-8", errors="replace", max_form_memory_size=None, max_content_length=None, cls=None, silent=True)
 
def exhaust_stream (f)
 
def is_valid_multipart_boundary (boundary)
 
def parse_multipart_headers (iterable)
 

Variables

 SpooledTemporaryFile
 

Function Documentation

◆ default_stream_factory()

def werkzeug.formparser.default_stream_factory (   total_content_length,
  filename,
  content_type,
  content_length = None 
)
The stream factory that is used per default.

◆ exhaust_stream()

def werkzeug.formparser.exhaust_stream (   f)
Helper decorator for methods that exhausts the stream on return.

◆ is_valid_multipart_boundary()

def werkzeug.formparser.is_valid_multipart_boundary (   boundary)
Checks if the string given is a valid multipart boundary.

◆ parse_form_data()

def werkzeug.formparser.parse_form_data (   environ,
  stream_factory = None,
  charset = "utf-8",
  errors = "replace",
  max_form_memory_size = None,
  max_content_length = None,
  cls = None,
  silent = True 
)
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 :ref:`dealing-with-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:`~BaseResponse._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)``.

◆ parse_multipart_headers()

def werkzeug.formparser.parse_multipart_headers (   iterable)
Parses multipart headers from an iterable that yields lines (including
the trailing newline symbol).  The iterable has to be newline terminated.

The iterable will stop at the line where the headers ended so it can be
further consumed.

:param iterable: iterable of strings that are newline terminated

Variable Documentation

◆ SpooledTemporaryFile

SpooledTemporaryFile