﻿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
15265	"Problem with ""__call__"" method in Templates"	Stephane	nobody	"Hi,

We have another problem in templates since Django 1.3 when we put dict values into template with ""__getitem__"".

We create this class for example:

class MyDict(object):
    TEST = {""var"": ""test"", ""meuh"": ""test2""}

    def __getitem__(self, key):
        """"""
        Retrieves a value. Raises a :exc:`KeyError` if *key* does not exists.
        """"""
        return MyDict.TEST[key]

    def __call__(self, **kwargs):
        """"""
        Puts one or more values into this...
        """"""
        for key, value in kwargs.items():
            self[key] = value

We add this in a template context:

test = MyDict()
return test

In the template, we want to get the value of ""var"" key for example:

{{mydict.var}}

No output... But if we remove ""__call__"" method, we have the value: ""test"" (same as before 1.3).

Best regards,

Stephane"		closed	Template system	1.3-beta		wontfix			Unreviewed	0	0	0	0	0	0
