Code

Opened 6 years ago

Closed 6 years ago

#6968 closed (duplicate)

misleading error message when base template has no blocks

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

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" 

Attachments (0)

Change History (1)

comment:1 Changed 6 years ago by ubernostrum

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #6558.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.