mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-21 14:05:16 +03:00
Temporarily roll back the streaming stuff
This commit is contained in:
parent
4687db680c
commit
3cdb4e2648
|
@ -1,5 +1,6 @@
|
||||||
from djangorestframework.mediatypes import MediaType
|
from djangorestframework.mediatypes import MediaType
|
||||||
#from djangorestframework.requestparsing import parse, load_parser
|
#from djangorestframework.requestparsing import parse, load_parser
|
||||||
|
from django.http.multipartparser import LimitBytes
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
|
|
||||||
class RequestMixin(object):
|
class RequestMixin(object):
|
||||||
|
@ -65,10 +66,17 @@ class RequestMixin(object):
|
||||||
Returns an object that may be used to stream the request content.
|
Returns an object that may be used to stream the request content.
|
||||||
"""
|
"""
|
||||||
if not hasattr(self, '_stream'):
|
if not hasattr(self, '_stream'):
|
||||||
if hasattr(self.request, 'read'):
|
request = self.request
|
||||||
self._stream = self.request
|
# We ought to be able to return a stream rather than reading the stream.
|
||||||
else:
|
# Not quite working just yet...
|
||||||
self._stream = StringIO(self.request.raw_post_data)
|
#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
|
return self._stream
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user