Ticket #1672: defaulttags.patch

File defaulttags.patch, 1.0 KB (added by Eric Evenson <evenson@…>, 19 years ago)
  • home/ese/var/python/django/django_src/django/core/template/defaulttags.py

     
    136136        return "<IfEqualNode>"
    137137
    138138    def render(self, context):
    139         val1 = resolve_variable(self.var1, context)
    140         val2 = resolve_variable(self.var2, context)
     139        try:
     140            val1 = resolve_variable(self.var1, context)
     141            val2 = resolve_variable(self.var2, context)
     142        except VariableDoesNotExist:
     143            if self.negate:
     144                return self.nodelist_true.render(context)
     145            else:
     146                return self.nodelist_false.render(context)
    141147        if (self.negate and val1 != val2) or (not self.negate and val1 == val2):
    142148            return self.nodelist_true.render(context)
    143149        return self.nodelist_false.render(context)
Back to Top