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
87deeab9
Commit
87deeab9
authored
Jan 24, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed the kwargs argument from the View constructor.
parent
d14e40dd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
38 deletions
+3
-38
pystache/view.py
+2
-2
tests/test_view.py
+1
-36
No files found.
pystache/view.py
View file @
87deeab9
...
...
@@ -52,7 +52,7 @@ class View(object):
locator
=
TemplateLocator
()
def
__init__
(
self
,
context
=
None
,
partials
=
None
,
**
kwargs
):
def
__init__
(
self
,
context
=
None
,
partials
=
None
):
"""
Construct a View instance.
...
...
@@ -66,7 +66,7 @@ class View(object):
no template with that name, or raise an exception.
"""
context
=
Context
.
create
(
self
,
context
,
**
kwargs
)
context
=
Context
.
create
(
self
,
context
)
self
.
_partials
=
partials
...
...
tests/test_view.py
View file @
87deeab9
...
...
@@ -38,23 +38,6 @@ class ViewTestCase(unittest.TestCase):
view
=
TestView
()
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_kwargs
(
self
):
view
=
Simple
(
"Hi {{thing}}!"
,
thing
=
'world'
)
self
.
assertEquals
(
view
.
render
(),
"Hi world!"
)
def
test_render
(
self
):
view
=
Simple
(
thing
=
'world'
)
self
.
assertEquals
(
view
.
render
(),
"Hi world!"
)
def
test_template_path
(
self
):
"""
Test that View.template_path is respected.
...
...
@@ -85,24 +68,6 @@ class ViewTestCase(unittest.TestCase):
view
.
template_path
=
"examples"
self
.
assertEquals
(
view
.
render
(),
"Partial: No tags..."
)
def
test_template_load_from_multiple_path
(
self
):
path
=
Simple
.
template_path
Simple
.
template_path
=
(
'examples/nowhere'
,
'examples'
,)
try
:
view
=
Simple
(
thing
=
'world'
)
self
.
assertEquals
(
view
.
render
(),
"Hi world!"
)
finally
:
Simple
.
template_path
=
path
def
test_template_load_from_multiple_path_fail
(
self
):
path
=
Simple
.
template_path
Simple
.
template_path
=
(
'examples/nowhere'
,)
try
:
view
=
Simple
(
thing
=
'world'
)
self
.
assertRaises
(
IOError
,
view
.
render
)
finally
:
Simple
.
template_path
=
path
def
test_basic_method_calls
(
self
):
view
=
Simple
()
self
.
assertEquals
(
view
.
render
(),
"Hi pizza!"
)
...
...
@@ -113,7 +78,7 @@ class ViewTestCase(unittest.TestCase):
self
.
assertEquals
(
view
.
render
(),
"Hi Chris!"
)
def
test_view_instances_as_attributes
(
self
):
other
=
Simple
(
name
=
'chris'
)
other
=
Simple
(
context
=
{
'name'
:
'chris'
}
)
other
.
template
=
'{{name}}'
view
=
Simple
()
view
.
thing
=
other
...
...
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