Commits

Anonymous committed e137cea Merge

Comments (0)

Files changed (3)

 .coverage
 .tox
 .DS_Store
+.idea/*

djangorestframework/parsers.py

             except ValueError, exc:
                 raise ErrorResponse(status.HTTP_400_BAD_REQUEST,
                                     {'detail': 'YAML parse error - %s' % unicode(exc)})
-
+else:
+    YAMLParser = None
 
 class PlainTextParser(BaseParser):
     """
                                 {'detail': 'multipart parse error - %s' % unicode(exc)})
         return django_parser.parse()
 
+DEFAULT_PARSERS = ( JSONParser,
+                    FormParser,
+                    MultiPartParser )
+
+if YAMLParser:
+    DEFAULT_PARSERS += (YAMLParser,)

djangorestframework/views.py

     """
     List of parsers the resource can parse the request with.
     """
-    parsers = ( parsers.JSONParser,
-                parsers.FormParser,
-                parsers.MultiPartParser )
+    parsers = parsers.DEFAULT_PARSERS
 
     """
     List of all authenticating methods to attempt.