This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
pystache /
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Thu Nov 12 22:42:03 -0800 2009 | |
| |
HISTORY.md | Mon Nov 16 17:38:27 -0800 2009 | |
| |
LICENSE | Thu Nov 12 22:26:08 -0800 2009 | |
| |
README.md | Wed Nov 11 16:52:48 -0800 2009 | |
| |
TODO | Fri Nov 13 15:32:52 -0800 2009 | |
| |
examples/ | Thu Nov 12 22:02:02 -0800 2009 | |
| |
pystache/ | Tue Nov 17 01:29:11 -0800 2009 | |
| |
setup.py | Fri Nov 13 16:21:23 -0800 2009 | |
| |
tests/ | Mon Nov 16 17:37:58 -0800 2009 |
README.md
Pystache
Inspired by ctemplate and et, Mustache is a framework-agnostic way to render logic-free views.
As ctemplates says, "It emphasizes separating logic from presentation: it is impossible to embed application logic in this template language."
Pystache is a Python implementation of Mustache. It has been tested with Python 2.6.1.
Documentation
For now check out the ctemplate or Mustache docs.
Use It
>>> import pystache
>>> pystache.render('Hi {{person}}!', {'person': '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
nose works great!
easy_install nose
cd pystache
nosetests
Author
context = { 'author': 'Chris Wanstrath', 'email': 'chris@ozmm.org' }
pystache.render("{{author}} :: {{email}}", context)







