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
17267413
Commit
17267413
authored
Dec 18, 2011
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added to the View class support for disable_escape.
parent
120d4225
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
pystache/view.py
+3
-2
tests/test_examples.py
+3
-0
No files found.
pystache/view.py
View file @
17267413
...
@@ -88,12 +88,13 @@ class View(object):
...
@@ -88,12 +88,13 @@ class View(object):
return
re
.
sub
(
'[A-Z]'
,
repl
,
template_name
)[
1
:]
return
re
.
sub
(
'[A-Z]'
,
repl
,
template_name
)[
1
:]
def
render
(
self
,
encoding
=
None
):
def
render
(
self
,
encoding
=
None
,
disable_escape
=
False
):
"""
"""
Return the view rendered using the current context.
Return the view rendered using the current context.
"""
"""
template
=
Template
(
self
.
get_template
(),
self
.
load_template
,
output_encoding
=
encoding
)
template
=
Template
(
self
.
get_template
(),
self
.
load_template
,
output_encoding
=
encoding
,
disable_escape
=
disable_escape
)
return
template
.
render
(
self
.
context
)
return
template
.
render
(
self
.
context
)
def
get
(
self
,
key
,
default
=
None
):
def
get
(
self
,
key
,
default
=
None
):
...
...
tests/test_examples.py
View file @
17267413
...
@@ -34,6 +34,9 @@ class TestView(unittest.TestCase):
...
@@ -34,6 +34,9 @@ class TestView(unittest.TestCase):
def
test_escaped
(
self
):
def
test_escaped
(
self
):
self
.
assertEquals
(
Escaped
()
.
render
(),
"<h1>Bear > Shark</h1>"
)
self
.
assertEquals
(
Escaped
()
.
render
(),
"<h1>Bear > Shark</h1>"
)
def
test_escaped_disabling
(
self
):
self
.
assertEquals
(
Escaped
()
.
render
(
disable_escape
=
True
),
"<h1>Bear > Shark</h1>"
)
def
test_unescaped
(
self
):
def
test_unescaped
(
self
):
self
.
assertEquals
(
Unescaped
()
.
render
(),
"<h1>Bear > Shark</h1>"
)
self
.
assertEquals
(
Unescaped
()
.
render
(),
"<h1>Bear > Shark</h1>"
)
...
...
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