Hi

I think I've found a bug in django.template.defaulttags.py

get_nodes_by_type() is not implemented for IfEqualNode class. It seems
like it should be implemented the same way as in IfNode.

Check out this simple test:

    def test_get_nodes_by_type(self):
        template_string1 = "{%ifequal x 0%} something {%else%}
something else {%endifequal%}"
        template_string2 = "{%if x %} something {%else%} something
else {%endif%}"
        t1 = Template(template_string1)
        t2 = Template(template_string2)
        nodes1 = t1.nodelist.get_nodes_by_type(Node)
        nodes2 = t2.nodelist.get_nodes_by_type(Node)
        self.assertEqual(3, len(nodes2)) #this will work OK, we'll get
IfNode and 2x TextNode
        self.assertEqual(3, len(nodes1)) #this will fail, only
IfEqualNode is returned


I'm almost sure this missing implementation is a bug and I'm curious
how this got unnoticed. Seems like this get_nodes_by_type() function
is never used internally? I've found it only because I needed to do
some extra validations on the template structure after it is compiled.
I'm using django 1.0 but I've checked that in 1.2 it's the same.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to