From 304786657a8cbff323f21b7297c142f6ca5a1cc1 Mon Sep 17 00:00:00 2001 From: markotibold Date: Mon, 16 May 2011 23:54:35 +0200 Subject: Getting rid of all errors and warnings that show up when building the docs, to make a clean start with the library documentation . --HG-- rename : docs/library/authenticators.rst => docs/library/authentication.rst rename : docs/library/emitters.rst => docs/library/renderers.rst --- docs/library/authentication.rst | 5 +++++ docs/library/authenticators.rst | 5 ----- docs/library/emitters.rst | 7 ------- docs/library/modelresource.rst | 9 --------- docs/library/renderers.rst | 10 ++++++++++ 5 files changed, 15 insertions(+), 21 deletions(-) create mode 100644 docs/library/authentication.rst delete mode 100644 docs/library/authenticators.rst delete mode 100644 docs/library/emitters.rst delete mode 100644 docs/library/modelresource.rst create mode 100644 docs/library/renderers.rst (limited to 'docs/library') diff --git a/docs/library/authentication.rst b/docs/library/authentication.rst new file mode 100644 index 00000000..d159f605 --- /dev/null +++ b/docs/library/authentication.rst @@ -0,0 +1,5 @@ +:mod:`authentication` +===================== + +.. automodule:: authentication + :members: diff --git a/docs/library/authenticators.rst b/docs/library/authenticators.rst deleted file mode 100644 index 407339f7..00000000 --- a/docs/library/authenticators.rst +++ /dev/null @@ -1,5 +0,0 @@ -:mod:`authenticators` -===================== - -.. automodule:: authenticators - :members: diff --git a/docs/library/emitters.rst b/docs/library/emitters.rst deleted file mode 100644 index 590ace0f..00000000 --- a/docs/library/emitters.rst +++ /dev/null @@ -1,7 +0,0 @@ -:mod:`emitters` -=============== - -The emitters module provides a set of emitters that can be plugged in to a :class:`.Resource`. An emitter is responsible for taking the output of a and serializing it to a given media type. A :class:`.Resource` can have a number of emitters, allow the same content to be serialized in a number of different formats depending on the requesting client's preferences, as specified in the HTTP Request's Accept header. - -.. automodule:: emitters - :members: diff --git a/docs/library/modelresource.rst b/docs/library/modelresource.rst deleted file mode 100644 index af760944..00000000 --- a/docs/library/modelresource.rst +++ /dev/null @@ -1,9 +0,0 @@ -:mod:`modelresource` -==================== - -.. note:: - - TODO - document this module properly - -.. automodule:: modelresource - :members: diff --git a/docs/library/renderers.rst b/docs/library/renderers.rst new file mode 100644 index 00000000..a9e72931 --- /dev/null +++ b/docs/library/renderers.rst @@ -0,0 +1,10 @@ +:mod:`renderers` +================ + +The renderers module provides a set of renderers that can be plugged in to a :class:`.Resource`. +A renderer is responsible for taking the output of a View and serializing it to a given media type. +A :class:`.Resource` can have a number of renderers, allow the same content to be serialized in a number +of different formats depending on the requesting client's preferences, as specified in the HTTP Request's Accept header. + +.. automodule:: renderers + :members: -- cgit v1.2.3 From 66b9bda9bf9492c5e1ffba162e044aacb51bbd7e Mon Sep 17 00:00:00 2001 From: markotibold Date: Tue, 17 May 2011 00:18:45 +0200 Subject: All top level modules are included. Ready for diving into the modules and documenting/ enhancing already existing docs. --- docs/library/compat.rst | 5 +++++ docs/library/mixins.rst | 5 +++++ docs/library/permissions.rst | 5 +++++ docs/library/views.rst | 5 +++++ 4 files changed, 20 insertions(+) create mode 100644 docs/library/compat.rst create mode 100644 docs/library/mixins.rst create mode 100644 docs/library/permissions.rst create mode 100644 docs/library/views.rst (limited to 'docs/library') diff --git a/docs/library/compat.rst b/docs/library/compat.rst new file mode 100644 index 00000000..93fb081a --- /dev/null +++ b/docs/library/compat.rst @@ -0,0 +1,5 @@ +:mod:`compat` +===================== + +.. automodule:: compat + :members: diff --git a/docs/library/mixins.rst b/docs/library/mixins.rst new file mode 100644 index 00000000..04bf66b0 --- /dev/null +++ b/docs/library/mixins.rst @@ -0,0 +1,5 @@ +:mod:`mixins` +===================== + +.. automodule:: mixins + :members: diff --git a/docs/library/permissions.rst b/docs/library/permissions.rst new file mode 100644 index 00000000..c694d639 --- /dev/null +++ b/docs/library/permissions.rst @@ -0,0 +1,5 @@ +:mod:`permissions` +===================== + +.. automodule:: permissions + :members: diff --git a/docs/library/views.rst b/docs/library/views.rst new file mode 100644 index 00000000..329b487b --- /dev/null +++ b/docs/library/views.rst @@ -0,0 +1,5 @@ +:mod:`views` +===================== + +.. automodule:: views + :members: -- cgit v1.2.3 From 82c4ca96126cfedd4a8471452d956e8bb432ba5b Mon Sep 17 00:00:00 2001 From: markotibold Date: Thu, 19 May 2011 19:36:30 +0200 Subject: The core is now documented from the docstrings in the source. --- docs/library/resource.rst | 135 +--------------------------------------------- 1 file changed, 2 insertions(+), 133 deletions(-) (limited to 'docs/library') diff --git a/docs/library/resource.rst b/docs/library/resource.rst index b6cf028e..2a95051b 100644 --- a/docs/library/resource.rst +++ b/docs/library/resource.rst @@ -1,136 +1,5 @@ :mod:`resource` =============== -.. module:: resource - -The :mod:`resource` module is the core of Django REST framework. It provides the :class:`Resource` base class which handles incoming HTTP requests and maps them to method calls, performing authentication, input deserialization, input validation and output serialization. - -Resources are created by sublassing :class:`Resource`, setting a number of class attributes, and overriding one or more methods. - -.. class:: Resource - -:class:`Resource` class attributes ----------------------------------- - -The following class attributes determine the behavior of the Resource and are intended to be overridden. - -.. attribute:: Resource.allowed_methods - - A list of the HTTP methods that the Resource supports. - HTTP requests to the resource that do not map to an allowed operation will result in a 405 Method Not Allowed response. - - Default: ``('GET',)`` - -.. attribute:: Resource.anon_allowed_methods - - A list of the HTTP methods that the Resource supports for unauthenticated users. - Unauthenticated HTTP requests to the resource that do not map to an allowed operation will result in a 405 Method Not Allowed response. - - Default: ``()`` - -.. attribute:: Resource.emitters - - The list of emitters that the Resource supports. This determines which media types the resource can serialize it's output to. Clients can specify which media types they accept using standard HTTP content negotiation via the Accept header. (See `RFC 2616 - Sec 14.1 `_) Clients can also override this standard content negotiation by specifying a `_format` ... - - The :mod:`emitters` module provides the :class:`BaseEmitter` class and a set of default emitters, including emitters for JSON and XML, as well as emitters for HTML and Plain Text which provide for a self documenting API. - - The ordering of the Emitters is important as it determines an order of preference. - - Default: ``(emitters.JSONEmitter, emitters.DocumentingHTMLEmitter, emitters.DocumentingXHTMLEmitter, emitters.DocumentingPlainTextEmitter, emitters.XMLEmitter)`` - -.. attribute:: Resource.parsers - - The list of parsers that the Resource supports. This determines which media types the resource can accept as input for incoming HTTP requests. (Typically PUT and POST requests). - - The ordering of the Parsers may be considered informative of preference but is not used ... - - Default: ``(parsers.JSONParser, parsers.XMLParser, parsers.FormParser)`` - -.. attribute:: Resource.authenticators - - The list of authenticators that the Resource supports. This determines which authentication methods (eg Basic, Digest, OAuth) are used to authenticate requests. - - Default: ``(authenticators.UserLoggedInAuthenticator, authenticators.BasicAuthenticator)`` - -.. attribute:: Resource.form - - If not None, this attribute should be a Django form which will be used to validate any request data. - This attribute is typically only used for POST or PUT requests to the resource. - - Deafult: ``None`` - -.. attribute:: Resource.callmap - - Maps HTTP methods to function calls on the :class:`Resource`. It may be overridden in order to add support for other HTTP methods such as HEAD, OPTIONS and PATCH, or in order to map methods to different function names, for example to use a more `CRUD `_ like style. - - Default: ``{ 'GET': 'get', 'POST': 'post', 'PUT': 'put', 'DELETE': 'delete' }`` - - -:class:`Resource` methods -------------------------- - -.. method:: Resource.get -.. method:: Resource.post -.. method:: Resource.put -.. method:: Resource.delete -.. method:: Resource.authenticate -.. method:: Resource.reverse - -:class:`Resource` properties ----------------------------- - -.. method:: Resource.name -.. method:: Resource.description -.. method:: Resource.default_emitter -.. method:: Resource.default_parser -.. method:: Resource.emitted_media_types -.. method:: Resource.parsed_media_types - -:class:`Resource` reserved form and query parameters ----------------------------------------------------- - -.. attribute:: Resource.ACCEPT_QUERY_PARAM - - If set, allows the default `Accept:` header content negotiation to be bypassed by setting the requested media type in a query parameter on the URL. This can be useful if it is necessary to be able to hyperlink to a given format on the Resource using standard HTML. - - Set to None to disable, or to another string value to use another name for the reserved URL query parameter. - - Default: ``"_accept"`` - -.. attribute:: Resource.METHOD_PARAM - - If set, allows for PUT and DELETE requests to be tunneled on form POST operations, by setting a (typically hidden) form field with the method name. This allows standard HTML forms to perform method requests which would otherwise `not be supported `_ - - Set to None to disable, or to another string value to use another name for the reserved form field. - - Default: ``"_method"`` - -.. attribute:: Resource.CONTENTTYPE_PARAM - - Used together with :attr:`CONTENT_PARAM`. - - If set, allows for arbitrary content types to be tunneled on form POST operations, by setting a form field with the content type. This allows standard HTML forms to perform requests with content types other those `supported by default `_ (ie. `application/x-www-form-urlencoded`, `multipart/form-data`, and `text-plain`) - - Set to None to disable, or to another string value to use another name for the reserved form field. - - Default: ``"_contenttype"`` - -.. attribute:: Resource.CONTENT_PARAM - - Used together with :attr:`CONTENTTYPE_PARAM`. - - Set to None to disable, or to another string value to use another name for the reserved form field. - - Default: ``"_content"`` - -.. attribute:: Resource.CSRF_PARAM - - The name used in Django's (typically hidden) form field for `CSRF Protection `_. - - Setting to None does not disable Django's CSRF middleware, but it does mean that the field name will not be treated as reserved by FlyWheel, so for example the default :class:`FormParser` will return fields with this as part of the request content, rather than ignoring them. - - Default:: ``"csrfmiddlewaretoken"`` - -reserved params -internal methods - +.. automodule:: resources + :members: -- cgit v1.2.3