aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Alm2011-07-02 19:03:26 +0200
committerJens Alm2011-07-02 19:03:26 +0200
commitf73588eb425f611cb79c7a56133690328739bf6c (patch)
tree0a55eff1a43ae628f835af04f445042f8d2150f4
parent1885012d61c7ba78e78648ef2bff89e4337c0407 (diff)
downloaddjango-rest-framework-f73588eb425f611cb79c7a56133690328739bf6c.tar.bz2
parsers.DEFAULT_PARSERS added to be consistent with renderers.DEFAULT_RENDERERS
-rw-r--r--.gitignore1
-rw-r--r--djangorestframework/parsers.py6
-rw-r--r--djangorestframework/views.py4
3 files changed, 8 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index 4947943a..312b28df 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,4 @@ MANIFEST
.coverage
.tox
.DS_Store
+.idea/* \ No newline at end of file
diff --git a/djangorestframework/parsers.py b/djangorestframework/parsers.py
index 5f19c521..f4c8dcb4 100644
--- a/djangorestframework/parsers.py
+++ b/djangorestframework/parsers.py
@@ -167,3 +167,9 @@ class MultiPartParser(BaseParser):
{'detail': 'multipart parse error - %s' % unicode(exc)})
return django_parser.parse()
+DEFAULT_PARSERS = ( parsers.JSONParser,
+ parsers.FormParser,
+ parsers.MultiPartParser )
+
+if YAMLParser:
+ DEFAULT_PARSERS += (YAMLParser,)
diff --git a/djangorestframework/views.py b/djangorestframework/views.py
index eea3b97a..c25bb88f 100644
--- a/djangorestframework/views.py
+++ b/djangorestframework/views.py
@@ -44,9 +44,7 @@ class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView):
"""
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.