﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
10301	Refactor Serializer to support iteratation	Paul Egan	nobody	"The [source:django/trunk/django/core/serializers/base.py Serializer] interface forces the result to be fully materialised before use.  This prevents it's use for streaming responses.

Currently the closest you can come is something like the following, but the response doesn't return until the xml document is complete:
{{{
#!python
    response = HttpResponse(content_type='text/xml')
    serializer = serializers.get_serializer(""xml"")()
    serializer.serialize(queryset.iterator(), stream=response)
    return response
}}}

The attached patch adds an `iterator` method to `Serializer` which yields the serialised data in chunks.  This allows the serialisation of large query sets to be streamed to a response without using much memory:
{{{
#!python
    serializer = serializers.get_serializer(""xml"")()
    xml_iter = serializer.iterator(queryset.iterator(), chunk_size=100)
    return HttpResponse(xml_iter, content_type='text/xml')
}}}"		closed	Core (Serialization)	1.0		duplicate			Design decision needed	1	0	0	0	0	0
