Django

Code

Ticket #7318 (closed: fixed)

Opened 6 months ago

Last modified 5 months ago

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

Reported by: mk Assigned to: mk
Milestone: Component: Template system
Version: SVN Keywords: extends
Cc: mk@spinlock.ch Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

fix-extends-tag.patch (2.1 kB) - added by mk on 06/11/08 03:30:31.

Change History

06/11/08 03:30:31 changed by mk

  • attachment fix-extends-tag.patch added.

06/11/08 03:31:02 changed by mk

  • status changed from new to assigned.
  • needs_better_patch changed.
  • needs_tests changed.
  • owner changed from nobody to mk.
  • needs_docs changed.
  • 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.

06/18/08 07:59:39 changed by russellm

  • status changed from assigned to closed.
  • resolution set to fixed.

(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@spinlock.ch> for the original report and test case.


Add/Change #7318 (extends tag fails with an IndexError when parent template consists only of a TextNode (has patch))




Change Properties
Action