Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pystache_custom
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pystache_custom
Commits
921cd282
Commit
921cd282
authored
Dec 31, 2011
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Got doctests in README.rst working.
parent
7b7138b7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
13 deletions
+14
-13
README.rst
+8
-7
pystache/renderer.py
+6
-6
No files found.
README.rst
View file @
921cd282
...
...
@@ -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: ::
...
...
pystache/renderer.py
View file @
921cd282
...
...
@@ -310,7 +310,7 @@ class Renderer(object):
def
render
(
self
,
template
,
*
context
,
**
kwargs
):
"""
Render the given template (or template
d
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment