Opened 8 years ago

Closed 8 years ago

#7318 closed (fixed)

extends tag fails with an IndexError when parent template consists only of a TextNode (has patch)

Reported by: mk Owned by: mk
Component: Template system Version: master
Severity: Keywords: extends
Cc: mk@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Suppose, base.html does not contain any tags or blocks, and home.html only consists of '{% extends "base.html" %}', the extends tag falls flat on its face with an IndexError in ExtendsNode::render (Line 73)

The attached patch fixes this misbehaviour. (Granted, the usage is not make much sense, but Django still should not error out.)

I've added myself to the AUTHORS file. Feel free to drop the attribution (or commit a better patch)!

Attachments (1)

fix-extends-tag.patch (2.1 KB) - added by mk 8 years ago.

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by mk

comment:1 Changed 8 years ago by mk

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to mk
  • Patch needs improvement unset
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Ready for checkin

Promoting to ready for checkin, since this is a really simple fix for a file which was last modified in February 2008.

I've added some tests and a comment explaining why this change is necessary.

comment:2 Changed 8 years ago by russellm

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

(In [7688]) Fixed #7318 -- Cleaned up the template inheritance logic, specifically to handle the case where the parent template has no template tags/blocks. Took the opportunity to optimize the logic a little. Thanks to Matthias Kestenholz <mk@…> for the original report and test case.

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