1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

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
This commit is contained in:
Russell Keith-Magee
2010-04-12 13:56:38 +00:00
parent 55c31fbdef
commit 2cebe4395e
2 changed files with 12 additions and 1 deletions

View File

@@ -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)