aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/request.py
diff options
context:
space:
mode:
authortom christie tom@tomchristie.com2011-04-03 11:54:47 +0100
committertom christie tom@tomchristie.com2011-04-03 11:54:47 +0100
commit3cdb4e26486e93a22231a7224a31f1490554a00c (patch)
treea1676ddb8830fc69cce51f30e7c8ebfaa2f04430 /djangorestframework/request.py
parent4687db680cda52e9836743940e4cf7279b307294 (diff)
downloaddjango-rest-framework-3cdb4e26486e93a22231a7224a31f1490554a00c.tar.bz2
Temporarily roll back the streaming stuff
Diffstat (limited to 'djangorestframework/request.py')
-rw-r--r--djangorestframework/request.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/djangorestframework/request.py b/djangorestframework/request.py
index 9c6f8f30..5da679ef 100644
--- a/djangorestframework/request.py
+++ b/djangorestframework/request.py
@@ -1,5 +1,6 @@
from djangorestframework.mediatypes import MediaType
#from djangorestframework.requestparsing import parse, load_parser
+from django.http.multipartparser import LimitBytes
from StringIO import StringIO
class RequestMixin(object):
@@ -65,10 +66,17 @@ class RequestMixin(object):
Returns an object that may be used to stream the request content.
"""
if not hasattr(self, '_stream'):
- if hasattr(self.request, 'read'):
- self._stream = self.request
- else:
- self._stream = StringIO(self.request.raw_post_data)
+ request = self.request
+ # We ought to be able to return a stream rather than reading the stream.
+ # Not quite working just yet...
+ #if hasattr(request, 'read'):
+ # try:
+ # content_length = int(request.META.get('CONTENT_LENGTH',0))
+ # except (ValueError, TypeError):
+ # content_length = 0
+ # self._stream = LimitBytes(request, content_length)
+ #else:
+ self._stream = StringIO(request.raw_post_data)
return self._stream