I am new to chameleon templates. i paste code snippet ..
runtemp.py
import os
path = os.path.dirname(__file__)
from chameleon import PageTemplateLoader
templates = PageTemplateLoader(os.path.join(path, "templates"))
template = templates['mytemp.pt']
template(name='John')
print str(template.read())
mytem.pt
<testtag>
<innertesttag>${name}</innertesttag>
</testtag>
But the output i got is
<testtag>
<innertesttag>${name}</innertesttag>
</testtag>
I was expectinng John in output instead od $(name)
What is going wrong ? how to render template?
template.read()
just reads the contents of the template; you discarded the actual rendering result.template(name='John')
returns the rendering.Do this instead: