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
90ae7cb4
Commit
90ae7cb4
authored
Nov 13, 2009
by
Chris Wanstrath
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure we're dealing with strings, always
parent
7fdebd3e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
1 deletions
+14
-1
HISTORY.md
+4
-0
pystache/template.py
+1
-1
tests/test_pystache.py
+9
-0
No files found.
HISTORY.md
View file @
90ae7cb4
## 0.1.1 (2009-11-12)
*
Ensure we're dealing with strings, always
## 0.1.0 (2009-11-12)
*
First release
pystache/template.py
View file @
90ae7cb4
...
...
@@ -94,7 +94,7 @@ class Template(object):
@modifier
(
None
)
def
render_tag
(
self
,
tag_name
,
context
):
"""Given a tag name and context, finds, escapes, and renders the tag."""
return
cgi
.
escape
(
context
.
get
(
tag_name
,
''
))
return
cgi
.
escape
(
str
(
context
.
get
(
tag_name
,
''
)
))
@modifier
(
'!'
)
def
render_comment
(
self
,
tag_name
=
None
,
context
=
None
):
...
...
tests/test_pystache.py
View file @
90ae7cb4
...
...
@@ -35,6 +35,15 @@ class TestPystache(unittest.TestCase):
ret
=
pystache
.
render
(
template
,
{
'set'
:
True
})
self
.
assertEquals
(
ret
,
"Ready set go!"
)
def
test_non_strings
(
self
):
template
=
"{{#stats}}({{key}} & {{value}}){{/stats}}"
stats
=
[]
stats
.
append
({
'key'
:
123
,
'value'
:
[
'something'
]})
stats
.
append
({
'key'
:
u"chris"
,
'value'
:
0.900
})
ret
=
pystache
.
render
(
template
,
{
'stats'
:
stats
})
self
.
assertEquals
(
ret
,
"""(123 & ['something'])(chris & 0.9)"""
)
def
test_sections
(
self
):
template
=
"""
<ul>
...
...
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