diff options
| -rw-r--r-- | djangorestframework/mixins.py | 8 | ||||
| -rw-r--r-- | djangorestframework/request.py | 18 | ||||
| -rw-r--r-- | docs/library/request.rst | 5 | 
3 files changed, 21 insertions, 10 deletions
diff --git a/djangorestframework/mixins.py b/djangorestframework/mixins.py index d016b0f1..e53f8e6a 100644 --- a/djangorestframework/mixins.py +++ b/djangorestframework/mixins.py @@ -40,7 +40,7 @@ __all__ = (  class RequestMixin(object):      """ -    `Mixin` class to provide request parsing behavior. +    `Mixin` class to enhance API of Django's standard `request`.      """      _USE_FORM_OVERLOADING = True @@ -50,15 +50,15 @@ class RequestMixin(object):      parsers = ()      """ -    The set of request parsers that the view can handle. +    The set of parsers that the request can handle.      Should be a tuple/list of classes as described in the :mod:`parsers` module.      """      def get_request_class(self):          """ -        Returns a custom subclass of Django's `HttpRequest`, providing new facilities -        such as direct access to the parsed request content. +        Returns a subclass of Django's `HttpRequest` with a richer API, +        as described in :mod:`request`.          """          if not hasattr(self, '_request_class'):              self._request_class = request_class_factory(self.request) diff --git a/djangorestframework/request.py b/djangorestframework/request.py index c0ae46de..40d92eef 100644 --- a/djangorestframework/request.py +++ b/djangorestframework/request.py @@ -1,9 +1,12 @@  """ -The :mod:`request` module provides a `Request` class that can be used -to replace the standard Django request passed to the views. -This replacement `Request` provides many facilities, like automatically -parsed request content, form overloading of method/content type/content, -better support for HTTP PUT method.  +The :mod:`request` module provides a :class:`Request` class that can be used  +to enhance the standard `request` object received in all the views. + +This enhanced request object offers the following : + +    - content automatically parsed according to `Content-Type` header, and available as :meth:`request.DATA<Request.DATA>` +    - full support of PUT method, including support for file uploads +    - form overloading of HTTP method, content type and content  """  from django.http import HttpRequest @@ -14,7 +17,7 @@ from djangorestframework.utils import as_tuple  from StringIO import StringIO -__all__ = ('Request') +__all__ = ('Request',)  def request_class_factory(request): @@ -30,6 +33,9 @@ def request_class_factory(request):  class Request(object): +    """ +    A mixin class allowing to enhance Django's standard HttpRequest. +    """      _USE_FORM_OVERLOADING = True      _METHOD_PARAM = '_method' diff --git a/docs/library/request.rst b/docs/library/request.rst new file mode 100644 index 00000000..5e99826a --- /dev/null +++ b/docs/library/request.rst @@ -0,0 +1,5 @@ +:mod:`request` +===================== + +.. automodule:: request +   :members:  | 
