Use the BytesIO for buffering bytes and import the one from the compat module.

This commit is contained in:
Xavier Ordoquy 2013-12-17 10:30:23 +01:00
parent 8894019899
commit 8026480454

View File

@ -183,9 +183,9 @@ At this point we've translated the model instance into Python native datatypes.
Deserialization is similar. First we parse a stream into Python native datatypes...
import StringIO
from rest_framework.compat import BytesIO
stream = StringIO.StringIO(content)
stream = BytesIO(content)
data = JSONParser().parse(stream)
...then we restore those native datatypes into to a fully populated object instance.