Commits

Jens Alm committed 9def52a

Set default renderers for views when yaml is not installed

Will use the renderer.DEFAULT_RENDERERS dict for determining available renderers in views.View to avoid a nonexistent renderer when yaml is not installed. Duplicates the behavior in parsers.DEFAULT_PARSERS

Comments (0)

Files changed (2)

djangorestframework/parsers.py

                                 {'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 renderers the resource can serialize the response with, ordered by preference.
     """
-    renderers = ( renderers.JSONRenderer,
-                  renderers.DocumentingHTMLRenderer,
-                  renderers.DocumentingXHTMLRenderer,
-                  renderers.DocumentingPlainTextRenderer,
-                  renderers.XMLRenderer,
-                  renderers.YAMLRenderer )
+    renderers = renderers.DEFAULT_RENDERERS
     
     """
     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.
     """