UPDATE 1 ADDED UPDATED CODE
I have a django template on app engine. Currently all my data is in several templates and I would like to read the templates off disk. Very easy, but I would like to get the values out of these templates in AppEngine.
eg. file : p1.html
{%block price%}$259{%endblock%}
{%block buy%}http://www.highbeam.co.nz/store/index.php?route=product/product&path=6&product_id=116{%endblock%}
{%block info%}http://www.inov-8.co.nz/oroc280.html{%endblock%}
Can I load and read these template into some value and go.
template['price']
which would be
$259
I can easily inject data into the template, but I want to parse out the data between my block tags.
UPDATED 2 With the help of aaronasterling (THANKS) the final code is this. Final code to get the value out of a Django template on app engine. path = os.path.join(os.path.dirname(file), 'home/p2.html')
file = open(path)
entry = file.read()
file.close()
entry = entry.replace("{% extends \"product.html\" %}","")
t = Template(entry)
product = {}
for node in t.nodelist[0].nodelist :
if hasattr(node, 'name'):
product[node.name] = node.render(Context())