Ticket #15197: check_stream.patch

File check_stream.patch, 564 bytes (added by Hiroki Kiyohara, 12 years ago)

checking self.stream before return

  • django/core/serializers/pyyaml.py

    diff --git a/django/core/serializers/pyyaml.py b/django/core/serializers/pyyaml.py
    index 7a508da..bdaae6c 100644
    a b class Serializer(PythonSerializer):  
    4242        yaml.dump(self.objects, self.stream, Dumper=DjangoSafeDumper, **self.options)
    4343
    4444    def getvalue(self):
    45         return self.stream.getvalue()
     45        if callable(getattr(self.stream, 'getvalue', None)):
     46            return self.stream.getvalue()
    4647
    4748def Deserializer(stream_or_string, **options):
    4849    """
Back to Top