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
c689ce93
Commit
c689ce93
authored
Dec 17, 2011
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fix: View(context=context, **kwargs) could modify the passed context.
Also added a test case.
parent
a68ddb39
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
pystache/view.py
+3
-0
tests/test_view.py
+9
-0
No files found.
pystache/view.py
View file @
c689ce93
...
@@ -50,6 +50,9 @@ class View(object):
...
@@ -50,6 +50,9 @@ class View(object):
Construct a View instance.
Construct a View instance.
"""
"""
if
context
is
None
:
context
=
{}
if
load_template
is
not
None
:
if
load_template
is
not
None
:
self
.
_load_template
=
load_template
self
.
_load_template
=
load_template
...
...
tests/test_view.py
View file @
c689ce93
...
@@ -25,6 +25,15 @@ class ViewTestCase(unittest.TestCase):
...
@@ -25,6 +25,15 @@ class ViewTestCase(unittest.TestCase):
view
=
TestView
()
view
=
TestView
()
self
.
assertEquals
(
view
.
template
,
"foo"
)
self
.
assertEquals
(
view
.
template
,
"foo"
)
def
test_init__kwargs_does_not_modify_context
(
self
):
"""
Test that passing **kwargs does not modify the passed context.
"""
context
=
{
"foo"
:
"bar"
}
view
=
View
(
context
=
context
,
fuzz
=
"buzz"
)
self
.
assertEquals
(
context
,
{
"foo"
:
"bar"
})
def
test_basic
(
self
):
def
test_basic
(
self
):
view
=
Simple
(
"Hi {{thing}}!"
,
{
'thing'
:
'world'
})
view
=
Simple
(
"Hi {{thing}}!"
,
{
'thing'
:
'world'
})
self
.
assertEquals
(
view
.
render
(),
"Hi world!"
)
self
.
assertEquals
(
view
.
render
(),
"Hi world!"
)
...
...
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