#15265: Problem with "__call__" method in Templates -----------------------------+---------------------------------------------- Reporter: Stephane | Owner: nobody Status: new | Milestone: 1.3 Component: Template system | Version: 1.3-beta Keywords: | Triage Stage: Unreviewed Has patch: 0 | -----------------------------+---------------------------------------------- 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 -- Ticket URL: <http://code.djangoproject.com/ticket/15265> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.