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
d595856b
Commit
d595856b
authored
Jan 01, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
READM view example is now more real.
parent
f143e1ed
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
9 deletions
+17
-9
README.rst
+12
-9
examples/readme.py
+3
-0
examples/say_hello.mustache
+2
-0
No files found.
README.rst
View file @
d595856b
...
...
@@ -41,21 +41,24 @@ Use It
You can also create dedicated view classes to hold your view logic.
Here's your
simple.py
::
Here's your
view class (in `examples/readme.py`)
::
>>> class Simple
(object):
... def thing
(self):
... return "pizza
"
class SayHello
(object):
def to
(self):
return "World
"
Then your template, simple.mustache::
>>> from examples.readme import SayHello
>>> hello = SayHello()
Hi {{thing}}!
Then your template, `say_hello.mustache`::
Hello, {{to}}!
Pull it together::
>>> renderer = pystache.Renderer(
search_dirs='examples'
)
>>> renderer.render(
Simple()
)
u'H
i pizza
!'
>>> renderer = pystache.Renderer()
>>> renderer.render(
hello
)
u'H
ello, World
!'
Test It
...
...
examples/readme.py
0 → 100644
View file @
d595856b
class
SayHello
(
object
):
def
to
(
self
):
return
"World"
examples/say_hello.mustache
0 → 100644
View file @
d595856b
Hello,
{{
to
}}
!
\ No newline at end of file
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