hi,
I'd like to use the django-template-system without the rest of django.
so I tried a small example, which worked:
import os
os.environ["DJANGO_SETTINGS_MODULE"] = "__main__" #or appr. settings.py
from django.core.template import *
t = Template( """<h1>Hello {{name}}</h1>
print t.render( {"name": "Phillip"} )
but then I tried a more complicated example:
import os
os.environ["DJANGO_SETTINGS_MODULE"] = "__main__" #or appr. settings.py
from django.core.template import *
t = Template( "{% block test %}bla{% endblock %}" )
t.render( {} )
unfortunately, this did not work :(, but it threw an exception:
Traceback (most recent call last):
File "./template_test.py", line 6, in ?
t = Template( "{% block test %}bla{% endblock %}" )
File
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/template/__init__.py",
line 137, in __init__
self.nodelist = compile_string(template_string, origin)
File
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/template/__init__.py",
line 152, in compile_string
return parser.parse()
File
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/template/__init__.py",
line 302, in parse
self.invalid_block_tag(token, command)
File
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/template/__init__.py",
line 339, in invalid_block_tag
raise self.error( token, "Invalid block tag: '%s'" % command)
django.core.template.TemplateSyntaxError: Invalid block tag: 'block'
I tried a bit more, and found out that:
- {{var}} and {% if %} (and maybe some more) work.
- {% extends %} and {% block %} throw the exception above.
what can I do to make "extends" and "block" work ?
thanks,
Roland Koebler
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---