Opened 16 years ago

Closed 16 years ago

#7318 closed (fixed)

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

Reported by: Matthias Kestenholz Owned by: Matthias Kestenholz
Component: Template system Version: dev
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: no UI/UX: no

Description

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 Matthias Kestenholz 16 years ago.

Download all attachments as: .zip

Change History (3)

by Matthias Kestenholz, 16 years ago

Attachment: fix-extends-tag.patch added

comment:1 by Matthias Kestenholz, 16 years ago

Owner: changed from nobody to Matthias Kestenholz
Status: newassigned
Triage Stage: UnreviewedReady 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 by Russell Keith-Magee, 16 years ago

Resolution: fixed
Status: assignedclosed

(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