Commit 7ee1bbec by Jens Alm

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
parent 83b47c4b
...@@ -167,3 +167,9 @@ class MultiPartParser(BaseParser): ...@@ -167,3 +167,9 @@ class MultiPartParser(BaseParser):
{'detail': 'multipart parse error - %s' % unicode(exc)}) {'detail': 'multipart parse error - %s' % unicode(exc)})
return django_parser.parse() return django_parser.parse()
DEFAULT_PARSERS = ( JSONParser,
FormParser,
MultiPartParser )
if YAMLParser:
DEFAULT_PARSERS += (YAMLParser,)
\ No newline at end of file
...@@ -40,20 +40,12 @@ class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView): ...@@ -40,20 +40,12 @@ class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView):
""" """
List of renderers the resource can serialize the response with, ordered by preference. List of renderers the resource can serialize the response with, ordered by preference.
""" """
renderers = ( renderers.JSONRenderer, renderers = renderers.DEFAULT_RENDERERS
renderers.DocumentingHTMLRenderer,
renderers.DocumentingXHTMLRenderer,
renderers.DocumentingPlainTextRenderer,
renderers.XMLRenderer,
renderers.YAMLRenderer )
""" """
List of parsers the resource can parse the request with. List of parsers the resource can parse the request with.
""" """
parsers = ( parsers.JSONParser, parsers = parsers.DEFAULT_PARSERS
parsers.FormParser,
parsers.MultiPartParser )
""" """
List of all authenticating methods to attempt. List of all authenticating methods to attempt.
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment