Commit 921cd282 by Chris Jerdonek

Got doctests in README.rst working.

parent 7b7138b7
......@@ -37,16 +37,17 @@ Use It
>>> import pystache
>>> pystache.render('Hi {{person}}!', {'person': 'Mom'})
'Hi Mom!'
u'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"
>>> import pystache
>>> class Simple(pystache.View):
... template_path = 'examples'
... def thing(self):
... return "pizza"
Then your template, simple.mustache::
......@@ -55,7 +56,7 @@ Then your template, simple.mustache::
Pull it together::
>>> Simple().render()
'Hi pizza!'
u'Hi pizza!'
Test It
......@@ -65,7 +66,7 @@ nose_ works great! ::
pip install nose
cd pystache
nosetests --with-doctest
nosetests --with-doctest --doctest-extension=rst
To include tests from the mustache spec_ in your test runs: ::
......
......@@ -310,7 +310,7 @@ class Renderer(object):
def render(self, template, *context, **kwargs):
"""
Render the given template (or templated object) using the given context.
Render the given template (or template object) using the given context.
Returns the rendering as a unicode string.
......@@ -321,11 +321,11 @@ class Renderer(object):
Arguments:
template: a template string of type unicode or str, or an object
instance. If the argument is an object, for the template string
the function attempts to find a template associated to the
object by calling the get_associated_template() method. The
argument in this case is also used as the first element of the
context stack when rendering the associated template.
instance. If the argument is an object, the function first looks
for the template associated to the object by calling this class's
get_associated_template() method. The rendering process also
uses the passed object as the first element of the context stack
when rendering.
*context: zero or more dictionaries, Context instances, or objects
with which to populate the initial context stack. None
......
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