diff options
| author | Tom Christie | 2014-12-03 23:24:06 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-12-03 23:24:06 +0000 |
| commit | 3d6620c72a9cbaedecc37cc76e591a79409de305 (patch) | |
| tree | ee3b2a12ee552daac3a49862ae2fc6e934975b34 /rest_framework/parsers.py | |
| parent | cd4d8660211e7af3b06986b68a9281be0b8ffacf (diff) | |
| parent | 731c8421afe3093a78cdabb9c3cc28fa52cd1c8e (diff) | |
| download | django-rest-framework-3d6620c72a9cbaedecc37cc76e591a79409de305.tar.bz2 | |
Merge
Diffstat (limited to 'rest_framework/parsers.py')
| -rw-r--r-- | rest_framework/parsers.py | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/rest_framework/parsers.py b/rest_framework/parsers.py index 6d0e932b..1960e5a8 100644 --- a/rest_framework/parsers.py +++ b/rest_framework/parsers.py @@ -12,7 +12,7 @@ from django.http import QueryDict from django.http.multipartparser import MultiPartParser as DjangoMultiPartParser from django.http.multipartparser import MultiPartParserError, parse_header, ChunkIter from django.utils import six -from rest_framework.compat import yaml, force_text, urlparse +from rest_framework.compat import force_text, urlparse from rest_framework.exceptions import ParseError from rest_framework import renderers import json @@ -63,29 +63,6 @@ class JSONParser(BaseParser): raise ParseError('JSON parse error - %s' % six.text_type(exc)) -class YAMLParser(BaseParser): - """ - Parses YAML-serialized data. - """ - - media_type = 'application/yaml' - - def parse(self, stream, media_type=None, parser_context=None): - """ - Parses the incoming bytestream as YAML and returns the resulting data. - """ - assert yaml, 'YAMLParser requires pyyaml to be installed' - - parser_context = parser_context or {} - encoding = parser_context.get('encoding', settings.DEFAULT_CHARSET) - - try: - data = stream.read().decode(encoding) - return yaml.safe_load(data) - except (ValueError, yaml.parser.ParserError) as exc: - raise ParseError('YAML parse error - %s' % six.text_type(exc)) - - class FormParser(BaseParser): """ Parser for form data. |
