﻿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
7377	"""extends"" and ""block"" tags are not available when constructing template from scratch"	mgeorge@…	Stephen Burrows	"with a fresh svn chekcout, made a new project, and run:
./manage.py shell


{{{
In [1]: from django.template import Template, Context 

In [2]: t = Template('''{% block title %}Hello{% end block %}''') 
---------------------------------------------------------------------------
TemplateSyntaxError                       Traceback (most recent call last)

/Users/mattgeorge/django-code/gapp/<ipython console> in <module>()

/Library/Python/2.5/site-packages/django/template/__init__.py in __init__(self, template_string, origin, name)
    164         if settings.TEMPLATE_DEBUG and origin is None:
    165             origin = StringOrigin(template_string)
--> 166         self.nodelist = compile_string(template_string, origin)
    167         self.name = name
    168 

/Library/Python/2.5/site-packages/django/template/__init__.py in compile_string(template_string, origin)
    185     lexer = lexer_class(template_string, origin)
    186     parser = parser_class(lexer.tokenize())
--> 187     return parser.parse()
    188 
    189 class Token(object):

/Library/Python/2.5/site-packages/django/template/__init__.py in parse(self, parse_until)
    267                     compile_func = self.tags[command]
    268                 except KeyError:
--> 269                     self.invalid_block_tag(token, command)
    270                 try:
    271                     compiled_result = compile_func(self, token)

/Library/Python/2.5/site-packages/django/template/__init__.py in invalid_block_tag(self, token, command)
    319 
    320     def invalid_block_tag(self, token, command):
--> 321         raise self.error(token, ""Invalid block tag: '%s'"" % command)
    322 
    323     def unclosed_block_tag(self, parse_until):

TemplateSyntaxError: Invalid block tag: 'block'

}}}

however, this works:

{{{
Matt-George:gapp mattgeorge$./manage.py shell
Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17) 
Type ""copyright"", ""credits"" or ""license"" for more information.

IPython 0.8.2 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: from django.template import Template, Context 

In [2]: from django.template.loader import *

In [3]: t = Template('''{% block title %}Hello{% endblock %}''')

}}}

it looks like the issue comes from the line:[[BR]]
add_to_builtins('django.template.loader_tags')

in django.template.loader

"	Bug	closed	Template system	dev	Normal	worksforme		elsdoerfer@…	Accepted	1	0	1	0	0	0
