﻿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
15756	Template regression with property lookups	Keryn Knight <keryn@…>	nobody	"Whilst upgrading from 1.2.5 to 1.3, a colleague discovered a somewhat weird and problematic variable lookup issue in the template system. I've attempted to compress it down into a replicable test. I've tested this on Windows and Mac, both running Python 2.6 and Django 1.2.5 & 1.3

{{{
from django.template import Context, Template

class A(object):
    name = 'A'
    def __init__(self, anything):
        ''' this is the crux of the problem? '''
        pass

class B(A):
    name = u'B'


class C(B):
    name = u'C'

out = Template('{% for c in class_list %}{{ c.name }}{% endfor %}')

# this works under 1.2.5, but not 1.3
fail_list = (A, B, C)
# this works under both.
pass_list = (A(1), B(2), C(3))

# using classes; expected historic output u'ABC', in 1.3 returns u''
out.render(Context({'class_list': fail_list}))
# using instantiated objects, always returns u'ABC'
out.render(Context({'class_list': pass_list}))
}}}

Interestingly, if the __init__ method of the class doesn't take additional parameters (ie: remove the ''anything'' kwarg), it seems to be fine. I have absolutely no clue about the inner workings of the template compiler, but I'm presuming it does some sort of clever variable resolution that's changed in this edge case.

Symptomatic of my ignorance of the templating voodoo is that I don't really know how to summarise the problem, so the title may be better expressed, and I may have missed pre-existing tickets for the same thing."	Bug	closed	Template system	1.3	Normal	invalid			Unreviewed	0	0	0	0	0	0
