Opened 18 years ago

Closed 18 years ago

#2303 closed defect (fixed)

[patch] Recent break to template resolve_variable with booleans

Reported by: anonymous Owned by: Adrian Holovaty
Component: Template system Version: dev
Severity: major Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Unable to evaluate "True" and "False" values inside an ifequal tag. The tag "{% ifequal 0 False %}" results in this exception:

Traceback (most recent call last):
File "/home/pete/src/osrc/django/django/template/__init__.py" in render_node
  706. result = node.render(context)
File "/home/pete/src/osrc/django/django/template/defaulttags.py" in render
  155. val2 = resolve_variable(self.var2, context)
File "/home/pete/src/osrc/django/django/template/__init__.py" in resolve_variable
  664. return current

  UnboundLocalError at /
  local variable 'current' referenced before assignment

The special cases for False and True do not set the local "current" variable,
which gets returned at the end of the function.

Looks like bug crept in from changeset:3269

Attachments (1)

templatebools.diff (528 bytes ) - added by anonymous 18 years ago.
Patch

Download all attachments as: .zip

Change History (3)

by anonymous, 18 years ago

Attachment: templatebools.diff added

Patch

comment:1 by anonymous, 18 years ago

Summary: Recent break to template resolve_variable with booleans[patch] Recent break to template resolve_variable with booleans

comment:2 by Adrian Holovaty, 18 years ago

Resolution: fixed
Status: newclosed

(In [3294]) Fixed #2303 -- Fixed bug in [3269] with regard to True and False special-casing in template system

Note: See TracTickets for help on using tickets.
Back to Top