﻿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
5241	Response middleware runs too early for streaming responses	bittor	Aymeric Augustin	"In order to output very large HTML files or do progresive rendering I let a view return an iterator. The actual HTML file is generated at the last step os request processing. It works fine as long as I don't use gettext to translate any variable/string/template/... during generation. If I do, I always get the default translation.

I hope the following code snippet will clarify what I mean:
{{{
def test(request):
    def f():
        print dict(request.session)
        yield ""<html><body>\n""
        for lang in ('es', 'en'):
            yield '<a href=""/i18n/setlang/?language=%(lang)s"">%(lang)s</a><br>'%locals()
        for i in range(10):
            yield (_('Current time:')+' %s<br>\n')%datetime.datetime.now()
            time.sleep(1)
        yield ""Done\n</body></html>\n""
    return HttpResponse(f())
}}}
In this case 'Current time:' is never translated (it is easy to fix in this case but not in others).

I found the problem and the patch working with Django 0.96 but I believe it also applies to the development version."	Bug	closed	HTTP handling	dev	Normal	fixed	internationalization, progresive rendering		Accepted	0	0	0	0	0	0
