Commit a1d46105 by Chris Wanstrath

mention view classes in the readme

parent a6dfe036
...@@ -24,6 +24,21 @@ Use It ...@@ -24,6 +24,21 @@ Use It
>>> pystache.render('Hi {{person}}!', {'person': 'Mom'}) >>> pystache.render('Hi {{person}}!', {'person': 'Mom'})
'Hi Mom!' 'Hi Mom!'
You can also create dedicated view classes to hold your view logic.
Here's your simple.py:
import pystache
class Simple(pystache.View):
def thing(self):
return "pizza"
Then your template, simple.mustache:
Hi {{thing}}!
Pull it together:
>>> Simple().render()
'Hi pizza!'
Test It Test It
------- -------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment