diff options
| author | José Padilla | 2014-11-29 14:43:05 -0400 | 
|---|---|---|
| committer | José Padilla | 2014-11-29 14:43:05 -0400 | 
| commit | 731c8421afe3093a78cdabb9c3cc28fa52cd1c8e (patch) | |
| tree | bcbcfcfb32d0ab0e59605a5564cf320913767d6d /docs | |
| parent | 3a5b3772fefc3c2f2c0899947cbc07bfe6e6b5d2 (diff) | |
| download | django-rest-framework-731c8421afe3093a78cdabb9c3cc28fa52cd1c8e.tar.bz2 | |
Remove YAML support from core
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/api-guide/parsers.md | 24 | ||||
| -rw-r--r-- | docs/api-guide/renderers.md | 42 | ||||
| -rw-r--r-- | docs/api-guide/settings.md | 4 | ||||
| -rw-r--r-- | docs/api-guide/testing.md | 4 | ||||
| -rw-r--r-- | docs/index.md | 2 | ||||
| -rw-r--r-- | docs/tutorial/2-requests-and-responses.md | 2 | 
6 files changed, 18 insertions, 60 deletions
| diff --git a/docs/api-guide/parsers.md b/docs/api-guide/parsers.md index 73e3a705..1e134c77 100644 --- a/docs/api-guide/parsers.md +++ b/docs/api-guide/parsers.md @@ -26,26 +26,26 @@ As an example, if you are sending `json` encoded data using jQuery with the [.aj  ## Setting the parsers -The default set of parsers may be set globally, using the `DEFAULT_PARSER_CLASSES` setting.  For example, the following settings would allow requests with `YAML` content. +The default set of parsers may be set globally, using the `DEFAULT_PARSER_CLASSES` setting.  For example, the following settings would allow requests with `JSON` content.      REST_FRAMEWORK = {          'DEFAULT_PARSER_CLASSES': ( -            'rest_framework.parsers.YAMLParser', +            'rest_framework.parsers.JSONParser',          )      }  You can also set the parsers used for an individual view, or viewset,  using the `APIView` class based views. -	from rest_framework.parsers import YAMLParser +	from rest_framework.parsers import JSONParser  	from rest_framework.response import Response      from rest_framework.views import APIView      class ExampleView(APIView):          """ -        A view that can accept POST requests with YAML content. +        A view that can accept POST requests with JSON content.          """ -        parser_classes = (YAMLParser,) +        parser_classes = (JSONParser,)          def post(self, request, format=None):              return Response({'received data': request.data}) @@ -53,10 +53,10 @@ using the `APIView` class based views.  Or, if you're using the `@api_view` decorator with function based views.      @api_view(['POST']) -    @parser_classes((YAMLParser,)) +    @parser_classes((JSONParser,))      def example_view(request, format=None):          """ -        A view that can accept POST requests with YAML content. +        A view that can accept POST requests with JSON content.          """          return Response({'received data': request.data}) @@ -70,14 +70,6 @@ Parses `JSON` request content.  **.media_type**: `application/json` -## YAMLParser - -Parses `YAML` request content. - -Requires the `pyyaml` package to be installed. - -**.media_type**: `application/yaml` -  ## XMLParser  Parses REST framework's default style of `XML` request content. @@ -161,7 +153,7 @@ By default this will include the following keys: `view`, `request`, `args`, `kwa  ## Example -The following is an example plaintext parser that will populate the `request.data` property with a string representing the body of the request.  +The following is an example plaintext parser that will populate the `request.data` property with a string representing the body of the request.      class PlainTextParser(BaseParser):      """ diff --git a/docs/api-guide/renderers.md b/docs/api-guide/renderers.md index 035ec1d2..aa8da088 100644 --- a/docs/api-guide/renderers.md +++ b/docs/api-guide/renderers.md @@ -18,11 +18,11 @@ For more information see the documentation on [content negotiation][conneg].  ## Setting the renderers -The default set of renderers may be set globally, using the `DEFAULT_RENDERER_CLASSES` setting.  For example, the following settings would use `YAML` as the main media type and also include the self describing API. +The default set of renderers may be set globally, using the `DEFAULT_RENDERER_CLASSES` setting.  For example, the following settings would use `JSON` as the main media type and also include the self describing API.      REST_FRAMEWORK = {          'DEFAULT_RENDERER_CLASSES': ( -            'rest_framework.renderers.YAMLRenderer', +            'rest_framework.renderers.JSONRenderer',              'rest_framework.renderers.BrowsableAPIRenderer',          )      } @@ -31,15 +31,15 @@ You can also set the renderers used for an individual view, or viewset,  using the `APIView` class based views.      from django.contrib.auth.models import User -    from rest_framework.renderers import JSONRenderer, YAMLRenderer +    from rest_framework.renderers import JSONRenderer      from rest_framework.response import Response      from rest_framework.views import APIView      class UserCountView(APIView):          """ -        A view that returns the count of active users, in JSON or YAML. +        A view that returns the count of active users in JSON.          """ -        renderer_classes = (JSONRenderer, YAMLRenderer) +        renderer_classes = (JSONRenderer, )          def get(self, request, format=None):              user_count = User.objects.filter(active=True).count() @@ -113,38 +113,6 @@ The `jsonp` approach is essentially a browser hack, and is [only appropriate for  **.charset**: `utf-8` -## YAMLRenderer - -Renders the request data into `YAML`. - -Requires the `pyyaml` package to be installed. - -Note that non-ascii characters will be rendered using `\uXXXX` character escape.  For example: - -    unicode black star: "\u2605" - -**.media_type**: `application/yaml` - -**.format**: `'.yaml'` - -**.charset**: `utf-8` - -## UnicodeYAMLRenderer - -Renders the request data into `YAML`. - -Requires the `pyyaml` package to be installed. - -Note that non-ascii characters will not be character escaped.  For example: - -    unicode black star: ★ - -**.media_type**: `application/yaml` - -**.format**: `'.yaml'` - -**.charset**: `utf-8` -  ## XMLRenderer  Renders REST framework's default style of `XML` response content. diff --git a/docs/api-guide/settings.md b/docs/api-guide/settings.md index 9005511b..623d89fb 100644 --- a/docs/api-guide/settings.md +++ b/docs/api-guide/settings.md @@ -12,10 +12,10 @@ For example your project's `settings.py` file might include something like this:      REST_FRAMEWORK = {          'DEFAULT_RENDERER_CLASSES': ( -            'rest_framework.renderers.YAMLRenderer', +            'rest_framework.renderers.JSONRenderer',          ),          'DEFAULT_PARSER_CLASSES': ( -            'rest_framework.parsers.YAMLParser', +            'rest_framework.parsers.JSONParser',          )      } diff --git a/docs/api-guide/testing.md b/docs/api-guide/testing.md index d059fdab..cd8c7820 100644 --- a/docs/api-guide/testing.md +++ b/docs/api-guide/testing.md @@ -255,14 +255,14 @@ The default format used to make test requests may be set using the `TEST_REQUEST  If you need to test requests using something other than multipart or json requests, you can do so by setting the `TEST_REQUEST_RENDERER_CLASSES` setting. -For example, to add support for using `format='yaml'` in test requests, you might have something like this in your `settings.py` file. +For example, to add support for using `format='html'` in test requests, you might have something like this in your `settings.py` file.      REST_FRAMEWORK = {          ...          'TEST_REQUEST_RENDERER_CLASSES': (              'rest_framework.renderers.MultiPartRenderer',              'rest_framework.renderers.JSONRenderer', -            'rest_framework.renderers.YAMLRenderer' +            'rest_framework.renderers.TemplateHTMLRenderer'          )      } diff --git a/docs/index.md b/docs/index.md index b5257c73..c2836dbb 100644 --- a/docs/index.md +++ b/docs/index.md @@ -54,7 +54,6 @@ REST framework requires the following:  The following packages are optional:  * [Markdown][markdown] (2.1.0+) - Markdown support for the browsable API. -* [PyYAML][yaml] (3.10+) - YAML content-type support.  * [defusedxml][defusedxml] (0.3+) - XML content-type support.  * [django-filter][django-filter] (0.5.4+) - Filtering support.  * [django-oauth-plus][django-oauth-plus] (2.0+) and [oauth2][oauth2] (1.5.211+) - OAuth 1.0a support. @@ -258,7 +257,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  [mozilla]: http://www.mozilla.org/en-US/about/  [eventbrite]: https://www.eventbrite.co.uk/about/  [markdown]: http://pypi.python.org/pypi/Markdown/ -[yaml]: http://pypi.python.org/pypi/PyYAML  [defusedxml]: https://pypi.python.org/pypi/defusedxml  [django-filter]: http://pypi.python.org/pypi/django-filter  [oauth2]: https://github.com/simplegeo/python-oauth2 diff --git a/docs/tutorial/2-requests-and-responses.md b/docs/tutorial/2-requests-and-responses.md index f377c712..06a684b1 100644 --- a/docs/tutorial/2-requests-and-responses.md +++ b/docs/tutorial/2-requests-and-responses.md @@ -92,7 +92,7 @@ Here is the view for an individual snippet, in the `views.py` module.  This should all feel very familiar - it is not a lot different from working with regular Django views. -Notice that we're no longer explicitly tying our requests or responses to a given content type.  `request.data` can handle incoming `json` requests, but it can also handle `yaml` and other formats.  Similarly we're returning response objects with data, but allowing REST framework to render the response into the correct content type for us. +Notice that we're no longer explicitly tying our requests or responses to a given content type.  `request.data` can handle incoming `json` requests, but it can also handle other formats.  Similarly we're returning response objects with data, but allowing REST framework to render the response into the correct content type for us.  ## Adding optional format suffixes to our URLs | 
