Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.2.X] Fixed #14888 -- Removing duplicated code in serialisers. Than…

…ks to eric.fortin.

Backport of [15163] from trunk

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15164 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 989486d05daae847e5b121d6bef5bb53b16cfe98 1 parent d065e7e
@andrewgodwin andrewgodwin authored
View
6 django/core/serializers/base.py
@@ -31,9 +31,9 @@ def serialize(self, queryset, **options):
"""
self.options = options
- self.stream = options.get("stream", StringIO())
- self.selected_fields = options.get("fields")
- self.use_natural_keys = options.get("use_natural_keys", False)
+ self.stream = options.pop("stream", StringIO())
+ self.selected_fields = options.pop("fields", None)
+ self.use_natural_keys = options.pop("use_natural_keys", False)
self.start_serialization()
for obj in queryset:
View
3  django/core/serializers/json.py
@@ -18,9 +18,6 @@ class Serializer(PythonSerializer):
internal_use_only = False
def end_serialization(self):
- self.options.pop('stream', None)
- self.options.pop('fields', None)
- self.options.pop('use_natural_keys', None)
simplejson.dump(self.objects, self.stream, cls=DjangoJSONEncoder, **self.options)
def getvalue(self):
View
3  django/core/serializers/pyyaml.py
@@ -38,9 +38,6 @@ def handle_field(self, obj, field):
super(Serializer, self).handle_field(obj, field)
def end_serialization(self):
- self.options.pop('stream', None)
- self.options.pop('fields', None)
- self.options.pop('use_natural_keys', None)
yaml.dump(self.objects, self.stream, Dumper=DjangoSafeDumper, **self.options)
def getvalue(self):
Please sign in to comment.
Something went wrong with that request. Please try again.