﻿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
6516	Template extends bug when passing a template variable to extends tag	Wayne K. Werner	nobody	"This is loosely related to #5124, at least the problems lie in the same code where extends resolution occurs during rendering of the !ExtendsNode.

Extended templates are fetched at the time that a child template is rendered.  This is done to defer fetching the extended template in the case where a variable is used to specify the template, as a context must be available.  This occurs in all cases, even when a hard coded string is passed, I assume to avoid having multiple !ExtendsNode types in similar fashion to the !IncludeNode types.

When an extended template is fetched, it is modified in two ways.  First, if the extended template also extends and there is a block in the child template that does not exist in the parent, that block is appended to the parents !ExtendsNode nodelist.  Second, when the block does exist in the parent, it is inserted into the parent template and block in the parent template is attached to the parent attribute of the inserted block to support block.super.

In the two cases where a template name is passed, either as a variable or hard coded, this does not cause a problem, as the template is fetched from source and discarded after rendering.  However in the case where an instantiated template is passed in, the passed in template is modified.

Rendering a template (or it's child) should make no changes to a template that will appear if it is rendered again.

I've included a file that demonstrates the case where the child block is inserted into the parent template with a link to it's super block.  The other case should not be too hard to verify with a three layer heirarchy.  I've also included a diff that '''does not''' fix the problem, but cleans up the code a bit and helps to clarify what is going on."	Bug	closed	Template system	dev	Normal	fixed	extends template overwrite		Unreviewed	0	0	0	0	0	0
