Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#13373 closed (fixed)

IF tag no longer short-circuits

Reported by: anonymous 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 6 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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

comment:2 Changed 6 years ago by Alex

I removed your email Jerry.

comment:3 Changed 6 years ago by russellm

  • milestone set to 1.2
  • Triage Stage changed from Unreviewed to Accepted

comment:4 Changed 6 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 6 years ago by Alex

  • 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 6 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(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 5 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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