Opened 17 years ago

Closed 17 years ago

#6968 closed (duplicate)

misleading error message when base template has no blocks

Reported by: James Tauber Owned by: nobody
Component: Uncategorized Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If one extends a template that has no blocks, the error shown is a IndexError. It would be nice if that case were caught and a message to the effect of "base template has no blocks" shown.

For example, change render() in loader_tags.py to catch IndexError:

        try:
            while isinstance(compiled_parent.nodelist[pos], TextNode):
                pos += 1
        except IndexError:
            raise TemplateSyntaxError, "Template cannot be extended, because it doesn't contain a TextNode" 

Change History (1)

comment:1 by James Bennett, 17 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #6558.

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