Fixed #3435 -- Fixed serializing to a file stream. Patch from SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5075 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
74bab89178
commit
e23ababb52
|
@ -105,8 +105,10 @@ class Serializer(object):
|
||||||
|
|
||||||
def getvalue(self):
|
def getvalue(self):
|
||||||
"""
|
"""
|
||||||
Return the fully serialized queryset.
|
Return the fully serialized queryset (or None if the output stream is
|
||||||
|
not seekable).
|
||||||
"""
|
"""
|
||||||
|
if callable(getattr(self.stream, 'getvalue', None)):
|
||||||
return self.stream.getvalue()
|
return self.stream.getvalue()
|
||||||
|
|
||||||
class Deserializer(object):
|
class Deserializer(object):
|
||||||
|
|
|
@ -19,6 +19,7 @@ class Serializer(PythonSerializer):
|
||||||
simplejson.dump(self.objects, self.stream, cls=DateTimeAwareJSONEncoder, **self.options)
|
simplejson.dump(self.objects, self.stream, cls=DateTimeAwareJSONEncoder, **self.options)
|
||||||
|
|
||||||
def getvalue(self):
|
def getvalue(self):
|
||||||
|
if callable(getattr(self.stream, 'getvalue', None)):
|
||||||
return self.stream.getvalue()
|
return self.stream.getvalue()
|
||||||
|
|
||||||
def Deserializer(stream_or_string, **options):
|
def Deserializer(stream_or_string, **options):
|
||||||
|
|
Loading…
Reference in New Issue