﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
6558	Need error message when inheriting from empty template	toomim	nobody	"If you inherit from a template with no blocks (for instance containing just the text ""Hello""), you get the following error message:

""Caught an exception while rendering: list index out of range""

I don't know what is supposed to happen, or if this is supposed to be allowed, but it would at least be way better to have an error like ""There are no blocks in the template foo.""

This happens when it's traversing the nodes in the inherited template while rendering, and finds only a TextNode and no block nodes. I don't really know what the code here is trying to do.

Here's the traceback. In my code, ""base.html"" is the template that says ""hello"".

----



Environment:

Request Method: GET
Request URL: http://localhost:8081/pubs/
Django Version: 0.97-pre-SVN-7092
Python Version: 2.5.0
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'dubweb.polls',
 'dubweb.pubs',
 'django.contrib.admin']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.doc.XViewMiddleware')


Template error:
In template /Users/toomim/projects/dubweb/dubweb/templates/pubs/index.html, error at line 1
   Caught an exception while rendering: list index out of range
   1 :  {% extends ""pubs/base.html"" %} 


   2 : 


   3 : {% block middlecontent %}


   4 : {% if venue_list %}


   5 : <ul>


   6 :   {% for venue in venue_list %}


   7 :   <li>Featured at {{ venue }}</li>


   8 :   <ul>


   9 :     {% for pub in venue.pub_set.all %}


   10 :     


   11 :     <li><b>{{ pub.title }}</b>


Traceback:
File ""/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/template/debug.py"" in render_node
  71.             result = node.render(context)
File ""/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/template/loader_tags.py"" in render
  73.         while isinstance(compiled_parent.nodelist[pos], TextNode):

Exception Type: IndexError at /pubs/
Exception Value: list index out of range

"		new	Template system	dev					Unreviewed	0	0	0	0	0	0
