diff --git a/django/core/serializers/json.py b/django/core/serializers/json.py
index 937d839..941b9e0 100644
a
|
b
|
class Serializer(PythonSerializer):
|
52 | 52 | self._current = None |
53 | 53 | |
54 | 54 | def getvalue(self): |
55 | | # overwrite PythonSerializer.getvalue() with base Serializer.getvalue() |
56 | | if callable(getattr(self.stream, 'getvalue', None)): |
57 | | return self.stream.getvalue() |
| 55 | # Grand-parent super |
| 56 | return super(PythonSerializer, self).getvalue() |
58 | 57 | |
59 | 58 | |
60 | 59 | def Deserializer(stream_or_string, **options): |
diff --git a/django/core/serializers/pyyaml.py b/django/core/serializers/pyyaml.py
index b639ad2..73e92d5 100644
a
|
b
|
class Serializer(PythonSerializer):
|
44 | 44 | yaml.dump(self.objects, self.stream, Dumper=DjangoSafeDumper, **self.options) |
45 | 45 | |
46 | 46 | def getvalue(self): |
47 | | return self.stream.getvalue() |
| 47 | # Grand-parent super |
| 48 | return super(PythonSerializer, self).getvalue() |
48 | 49 | |
49 | 50 | def Deserializer(stream_or_string, **options): |
50 | 51 | """ |
diff --git a/django/http/__init__.py b/django/http/__init__.py
index 30d7e5d..39f7a27 100644
a
|
b
|
class HttpResponse(object):
|
675 | 675 | chunk = chunk.encode(self._charset) |
676 | 676 | return str(chunk) |
677 | 677 | |
| 678 | def getvalue(self): |
| 679 | return self.content |
| 680 | |
678 | 681 | def close(self): |
679 | 682 | if hasattr(self._container, 'close'): |
680 | 683 | self._container.close() |
diff --git a/tests/regressiontests/serializers_regress/tests.py b/tests/regressiontests/serializers_regress/tests.py
index f1b70a1..468b51f 100644
a
|
b
|
from django.core import serializers
|
21 | 21 | from django.core.serializers import SerializerDoesNotExist |
22 | 22 | from django.core.serializers.base import DeserializationError |
23 | 23 | from django.db import connection, models |
| 24 | from django.http import HttpResponse |
24 | 25 | from django.test import TestCase |
25 | 26 | from django.utils.functional import curry |
26 | 27 | from django.utils.unittest import skipUnless |
… |
… |
def streamTest(format, self):
|
501 | 502 | obj.save_base(raw=True) |
502 | 503 | |
503 | 504 | # Serialize the test database to a stream |
504 | | stream = BytesIO() |
505 | | serializers.serialize(format, [obj], indent=2, stream=stream) |
| 505 | for stream in (BytesIO(), HttpResponse()): |
| 506 | serializers.serialize(format, [obj], indent=2, stream=stream) |
506 | 507 | |
507 | | # Serialize normally for a comparison |
508 | | string_data = serializers.serialize(format, [obj], indent=2) |
| 508 | # Serialize normally for a comparison |
| 509 | string_data = serializers.serialize(format, [obj], indent=2) |
509 | 510 | |
510 | | # Check that the two are the same |
511 | | self.assertEqual(string_data, stream.getvalue()) |
512 | | stream.close() |
| 511 | # Check that the two are the same |
| 512 | self.assertEqual(string_data, stream.getvalue()) |
| 513 | stream.close() |
513 | 514 | |
514 | 515 | for format in serializers.get_serializer_formats(): |
515 | 516 | setattr(SerializerTests, 'test_' + format + '_serializer', curry(serializerTest, format)) |