﻿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
12226	Test HttpResponse template attribute needlessly hard to use	Carl Meyer	Carl Meyer	"The {{{ template }}} attribute of the response objects returned by Django's test client might be a single template object or might be a list of template objects, depending whether template inheritance was used. If one tries to write tests that are usable in the presence of user-overridden templates, this results in noisy boilerplate in the tests:

{{{
response = client.get('/')
try:
    template_name = response.template.name
except AttributeError:
    template_name = response.template[0].name
}}}

There's no need for all this: the attribute should simply always be a list, sometimes of length 1.

I would suggest that a new attribute {{{ templates }}} could be added which is always a list, and the old attribute {{{ template }}} could go through the usual deprecation cycle.

I'll work on a patch if this approach is accepted in principle."		closed	Testing framework	dev		fixed	sprintSep2010		Accepted	1	1	0	1	0	0
