aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/parsers.py
diff options
context:
space:
mode:
Diffstat (limited to 'djangorestframework/parsers.py')
-rw-r--r--djangorestframework/parsers.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/djangorestframework/parsers.py b/djangorestframework/parsers.py
index 5f19c521..41f15aa3 100644
--- a/djangorestframework/parsers.py
+++ b/djangorestframework/parsers.py
@@ -108,7 +108,8 @@ if yaml:
except ValueError, exc:
raise ErrorResponse(status.HTTP_400_BAD_REQUEST,
{'detail': 'YAML parse error - %s' % unicode(exc)})
-
+else:
+ YAMLParser = None
class PlainTextParser(BaseParser):
"""
@@ -167,3 +168,9 @@ class MultiPartParser(BaseParser):
{'detail': 'multipart parse error - %s' % unicode(exc)})
return django_parser.parse()
+DEFAULT_PARSERS = ( JSONParser,
+ FormParser,
+ MultiPartParser )
+
+if YAMLParser:
+ DEFAULT_PARSERS += (YAMLParser,)