summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-04-12 13:56:38 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-04-12 13:56:38 +0000
commit2cebe4395e9ed345bbbe346b91842b4c97ffcfc7 (patch)
tree8afe1fe4b568d431fe989d00a1e27a86c1d612f4 /django
parent55c31fbdefe3bc3c948599b66781e7a9a1dae2a2 (diff)
Refs #13167 -- Corrected a regression in the way non-existent variables are handled by {% if %} tags. Thanks to ohmi2 for pointing out the regression in 1.2, and Karen for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12954 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/template/defaulttags.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py
index 9dd5fb766f..96efa32c0f 100644
--- a/django/template/defaulttags.py
+++ b/django/template/defaulttags.py
@@ -243,7 +243,12 @@ class IfNode(Node):
yield node
def render(self, context):
- if self.var.eval(context):
+ try:
+ var = self.var.eval(context)
+ except VariableDoesNotExist:
+ var = None
+
+ if var:
return self.nodelist_true.render(context)
else:
return self.nodelist_false.render(context)