Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#13373 closed (fixed)

IF tag no longer short-circuits

Reported by: (none) Owned by: nobody
Component: Template system Version: 1.2-beta
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


It looks like {% if %} with OR or AND no longer short circuits under 1.2-beta-1.

class Page(models.Model):

def beTrue(self):

print "BEING TRUE"
return True

def beFalse(self):

return False

{% if page.beTrue or page.beFalse %}


{% endif %}

Under 1.1.1, using runserver, I will only see "BEING TRUE" printed for the above snippet. Under 1.2-beta-1, I see both BEING TRUE and BEING FALSE.


{% if page.beFalse and page.beTrue %}


{% endif %}

will produce only "BEING FALSE" under 1.1.1, but both BEING FALSE and BEING TRUE under 1.2-beta-1.

Change History (7)

comment:1 Changed 8 years ago by anonymous

I didn't realize that the e-mail address it requests is displayed publicly. How can I remove that?

comment:2 Changed 8 years ago by Alex Gaynor

I removed your email Jerry.

comment:3 Changed 8 years ago by Russell Keith-Magee

milestone: 1.2
Triage Stage: UnreviewedAccepted

comment:4 Changed 8 years ago by anonymous

Thanks, Alex, but the problem has become recursive--my address now appears in your change history, where it's still public. How can I get rid of it completely?

comment:5 Changed 8 years ago by Alex Gaynor

Reporter: jerry@… deleted

Unfortunately if I remove the change in the admin it restores the original field. Sorry this is beyond my knowledge at this point.

comment:6 Changed 8 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [13001]) Fixed #13373 -- Ensured that {% if %} statements will short circuit template logic and not evaluate clauses that don't require evaluation. Thanks to Jerry Stratton for the report.

comment:7 Changed 7 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

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