request.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. from .accept import AcceptMixin
  2. from .auth import AuthorizationMixin
  3. from .base_request import BaseRequest
  4. from .common_descriptors import CommonRequestDescriptorsMixin
  5. from .cors import CORSRequestMixin
  6. from .etag import ETagRequestMixin
  7. from .user_agent import UserAgentMixin
  8. class Request(
  9. BaseRequest,
  10. AcceptMixin,
  11. ETagRequestMixin,
  12. UserAgentMixin,
  13. AuthorizationMixin,
  14. CORSRequestMixin,
  15. CommonRequestDescriptorsMixin,
  16. ):
  17. """Full featured request object implementing the following mixins:
  18. - :class:`AcceptMixin` for accept header parsing
  19. - :class:`ETagRequestMixin` for etag and cache control handling
  20. - :class:`UserAgentMixin` for user agent introspection
  21. - :class:`AuthorizationMixin` for http auth handling
  22. - :class:`~werkzeug.wrappers.cors.CORSRequestMixin` for Cross
  23. Origin Resource Sharing headers
  24. - :class:`CommonRequestDescriptorsMixin` for common headers
  25. """
  26. class StreamOnlyMixin(object):
  27. """If mixed in before the request object this will change the behavior
  28. of it to disable handling of form parsing. This disables the
  29. :attr:`files`, :attr:`form` attributes and will just provide a
  30. :attr:`stream` attribute that however is always available.
  31. .. versionadded:: 0.9
  32. """
  33. disable_data_descriptor = True
  34. want_form_data_parsed = False
  35. class PlainRequest(StreamOnlyMixin, Request):
  36. """A request object without special form parsing capabilities.
  37. .. versionadded:: 0.9
  38. """