aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/parsers.py
diff options
context:
space:
mode:
authorJosé Padilla2014-11-29 14:43:05 -0400
committerJosé Padilla2014-11-29 14:43:05 -0400
commit731c8421afe3093a78cdabb9c3cc28fa52cd1c8e (patch)
treebcbcfcfb32d0ab0e59605a5564cf320913767d6d /rest_framework/parsers.py
parent3a5b3772fefc3c2f2c0899947cbc07bfe6e6b5d2 (diff)
downloaddjango-rest-framework-731c8421afe3093a78cdabb9c3cc28fa52cd1c8e.tar.bz2
Remove YAML support from core
Diffstat (limited to 'rest_framework/parsers.py')
-rw-r--r--rest_framework/parsers.py25
1 files changed, 1 insertions, 24 deletions
diff --git a/rest_framework/parsers.py b/rest_framework/parsers.py
index ccb82f03..e6bb75f6 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 etree, yaml, force_text, urlparse
+from rest_framework.compat import etree, force_text, urlparse
from rest_framework.exceptions import ParseError
from rest_framework import renderers
import json
@@ -65,29 +65,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.