mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 16:24:18 +03:00
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
This commit is contained in:
parent
83b47c4b76
commit
7ee1bbecc6
|
@ -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,)
|
|
@ -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.
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user