Hi, I am trying to serialize some model data with the output going to a file. I am doing it the way its suggested in the documentation.
XMLSerializer = serializers.get_serializer("xml") xml_serializer = XMLSerializer() out = open("file.xml", "w") xml_serializer.serialize(SomeModel.objects.all(), stream=out) This throws an AttributeError- Traceback (most recent call last): File "<console>", line 1, in ? File "/home/ram/jasmine/Django-0.95/django/core/serializers/ base.py", line 50, in serialize return self.getvalue() File "/home/ram/jasmine/Django-0.95/django/core/serializers/ base.py", line 110, in getvalue return self.stream.getvalue() AttributeError: 'file' object has no attribute 'getvalue' Looking into base.py, I found that the serialize function attempts to return the entire data using getvalue function of the stream it wrote to. That works for StringIO which is used if one doesn't pass a stream, but not for a file object. This doesn't look like an intentional behavior. Am I missing something? Thanks, Ram --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---