Howdy --

In python, conditionals only evaluate the appropriate branch and only
after evaluating the condition. We can say:

if 'foo' in bar_dict:
    print bar_dict['foo']
else:
    print "Foo not in bar"

Even if bar_dict doesn't have a key 'foo' the first branch of the
conditional is not evaluated, and so a KeyError is not raised. Every
language does this.

However Django's template system evaluates the branches prior to
determining which will be followed. The following template will raise
a TemplateSyntaxError:

{% ifequal 0 1 %}{% load non_existant_tag_library %}{% endifequal %}

... because non_existant_tag_library doesn't exist. This should not
raise a TemplateSyntaxError.

I've submitted a patch on ticket #7251 to correct this. Thanks!

-jag

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

Reply via email to