aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/mixins.py
diff options
context:
space:
mode:
Diffstat (limited to 'djangorestframework/mixins.py')
-rw-r--r--djangorestframework/mixins.py19
1 files changed, 1 insertions, 18 deletions
diff --git a/djangorestframework/mixins.py b/djangorestframework/mixins.py
index 72dfe29d..4077b66c 100644
--- a/djangorestframework/mixins.py
+++ b/djangorestframework/mixins.py
@@ -68,7 +68,6 @@ class RequestMixin(object):
self._load_method_and_content_type()
return self._method
-
@property
def content_type(self):
"""
@@ -82,7 +81,6 @@ class RequestMixin(object):
self._load_method_and_content_type()
return self._content_type
-
@property
def DATA(self):
"""
@@ -95,7 +93,6 @@ class RequestMixin(object):
self._load_data_and_files()
return self._data
-
@property
def FILES(self):
"""
@@ -107,7 +104,6 @@ class RequestMixin(object):
self._load_data_and_files()
return self._files
-
def _load_data_and_files(self):
"""
Parse the request content into self.DATA and self.FILES.
@@ -118,7 +114,6 @@ class RequestMixin(object):
if not hasattr(self, '_data'):
(self._data, self._files) = self._parse(self._get_stream(), self._content_type)
-
def _load_method_and_content_type(self):
"""
Set the method and content_type, and then check if they've been overridden.
@@ -127,7 +122,6 @@ class RequestMixin(object):
self._content_type = self.request.META.get('HTTP_CONTENT_TYPE', self.request.META.get('CONTENT_TYPE', ''))
self._perform_form_overloading()
-
def _get_stream(self):
"""
Returns an object that may be used to stream the request content.
@@ -144,10 +138,9 @@ class RequestMixin(object):
if content_length == 0:
return None
elif hasattr(request, 'read'):
- return request
+ return request
return StringIO(request.raw_post_data)
-
def _perform_form_overloading(self):
"""
If this is a form POST request, then we need to check if the method and content/content_type have been
@@ -173,7 +166,6 @@ class RequestMixin(object):
stream = StringIO(self._data.pop(self._CONTENT_PARAM)[0])
(self._data, self._files) = self._parse(stream, self._content_type)
-
def _parse(self, stream, content_type):
"""
Parse the request content.
@@ -194,7 +186,6 @@ class RequestMixin(object):
{'error': 'Unsupported media type in request \'%s\'.' %
content_type})
-
@property
def _parsed_media_types(self):
"""
@@ -202,7 +193,6 @@ class RequestMixin(object):
"""
return [parser.media_type for parser in self.parsers]
-
@property
def _default_parser(self):
"""
@@ -211,7 +201,6 @@ class RequestMixin(object):
return self.parsers[0]
-
########## ResponseMixin ##########
class ResponseMixin(object):
@@ -233,7 +222,6 @@ class ResponseMixin(object):
Should be a tuple/list of classes as described in the :mod:`renderers` module.
"""
-
# TODO: wrap this behavior around dispatch(), ensuring it works
# out of the box with existing Django classes that use render_to_response.
def render(self, response):
@@ -266,7 +254,6 @@ class ResponseMixin(object):
return resp
-
def _determine_renderer(self, request):
"""
Determines the appropriate renderer for the output, given the client's 'Accept' header,
@@ -309,7 +296,6 @@ class ResponseMixin(object):
{'detail': 'Could not satisfy the client\'s Accept header',
'available_types': self._rendered_media_types})
-
@property
def _rendered_media_types(self):
"""
@@ -353,7 +339,6 @@ class AuthMixin(object):
Should be a tuple/list of classes as described in the :mod:`permissions` module.
"""
-
@property
def user(self):
"""
@@ -364,7 +349,6 @@ class AuthMixin(object):
self._user = self._authenticate()
return self._user
-
def _authenticate(self):
"""
Attempt to authenticate the request using each authentication class in turn.
@@ -377,7 +361,6 @@ class AuthMixin(object):
return user
return AnonymousUser()
-
# TODO: wrap this behavior around dispatch()
def _check_permissions(self):
"""