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
a15d8772
Commit
a15d8772
authored
Oct 30, 2009
by
Chris Wanstrath
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote branch 'ericflo/master'
parents
b5d30892
729b2e2c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
11 deletions
+8
-11
pystache/__init__.py
+3
-4
pystache/template.py
+2
-2
pystache/view.py
+3
-5
No files found.
pystache/__init__.py
View file @
a15d8772
from
pystache.template
import
Template
from
pystache.view
import
View
def
render
(
template
,
context
=
{},
**
kwargs
):
context
=
context
.
copy
()
for
key
in
kwargs
:
context
[
key
]
=
kwargs
[
key
]
def
render
(
template
,
context
=
None
,
**
kwargs
):
context
=
context
and
context
.
copy
()
or
{}
context
.
update
(
kwargs
)
return
Template
(
template
,
context
)
.
render
()
pystache/template.py
View file @
a15d8772
...
...
@@ -9,9 +9,9 @@ class Template(object):
'!'
:
'comment'
}
def
__init__
(
self
,
template
,
context
=
{}
):
def
__init__
(
self
,
template
,
context
=
None
):
self
.
template
=
template
self
.
context
=
context
self
.
context
=
context
or
{}
def
render
(
self
,
template
=
None
,
context
=
None
):
"""Turns a Mustache template into something wonderful."""
...
...
pystache/view.py
View file @
a15d8772
...
...
@@ -15,12 +15,10 @@ class View(object):
# Contents of the template.
template
=
None
def
__init__
(
self
,
template
=
None
,
context
=
{}
,
**
kwargs
):
def
__init__
(
self
,
template
=
None
,
context
=
None
,
**
kwargs
):
self
.
template
=
template
self
.
context
=
context
for
key
in
kwargs
:
self
.
context
[
key
]
=
kwargs
[
key
]
self
.
context
=
context
or
{}
self
.
context
.
update
(
kwargs
)
def
load_template
(
self
):
if
self
.
template
:
...
...
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