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
a49fa8cb
Commit
a49fa8cb
authored
Dec 23, 2011
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The Renderer's default Loader now inherits the decode_errors argument.
parent
79cc6c94
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
pystache/renderer.py
+3
-2
tests/test_renderer.py
+11
-0
No files found.
pystache/renderer.py
View file @
a49fa8cb
...
@@ -55,7 +55,8 @@ class Renderer(object):
...
@@ -55,7 +55,8 @@ class Renderer(object):
the method should either return None (as dict.get() does) or
the method should either return None (as dict.get() does) or
raise an exception.
raise an exception.
Defaults to constructing a Loader instance with
Defaults to constructing a Loader instance with
default_encoding passed as the encoding argument.
default_encoding and decode_errors passed as the encoding and
decode_errors arguments, respectively.
output_encoding: the encoding to use when rendering to a string.
output_encoding: the encoding to use when rendering to a string.
The argument should be the name of an encoding as a string, for
The argument should be the name of an encoding as a string, for
...
@@ -93,7 +94,7 @@ class Renderer(object):
...
@@ -93,7 +94,7 @@ class Renderer(object):
escape
=
markupsafe
.
escape
if
markupsafe
else
cgi
.
escape
escape
=
markupsafe
.
escape
if
markupsafe
else
cgi
.
escape
if
loader
is
None
:
if
loader
is
None
:
loader
=
Loader
(
encoding
=
default_encoding
)
loader
=
Loader
(
encoding
=
default_encoding
,
decode_errors
=
decode_errors
)
literal
=
markupsafe
.
Markup
if
markupsafe
else
unicode
literal
=
markupsafe
.
Markup
if
markupsafe
else
unicode
...
...
tests/test_renderer.py
View file @
a49fa8cb
...
@@ -43,6 +43,17 @@ class RendererInitTestCase(unittest.TestCase):
...
@@ -43,6 +43,17 @@ class RendererInitTestCase(unittest.TestCase):
# Check all attributes for good measure.
# Check all attributes for good measure.
self
.
assertEquals
(
actual
.
__dict__
,
expected
.
__dict__
)
self
.
assertEquals
(
actual
.
__dict__
,
expected
.
__dict__
)
def
test_loader__default__decode_errors
(
self
):
"""Test that the default loader inherits the decode_errors."""
r
=
Renderer
(
decode_errors
=
'foo'
)
actual
=
r
.
loader
expected
=
Loader
(
decode_errors
=
'foo'
)
self
.
assertEquals
(
actual
.
decode_errors
,
expected
.
decode_errors
)
# Check all attributes for good measure.
self
.
assertEquals
(
actual
.
__dict__
,
expected
.
__dict__
)
class
RendererTestCase
(
unittest
.
TestCase
):
class
RendererTestCase
(
unittest
.
TestCase
):
...
...
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