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
d14e40dd
Commit
d14e40dd
authored
Jan 24, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed template from the View constructor.
parent
dc732360
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
26 deletions
+9
-26
pystache/view.py
+1
-4
tests/test_examples.py
+0
-6
tests/test_renderengine.py
+8
-0
tests/test_view.py
+0
-16
No files found.
pystache/view.py
View file @
d14e40dd
...
...
@@ -52,7 +52,7 @@ class View(object):
locator
=
TemplateLocator
()
def
__init__
(
self
,
template
=
None
,
context
=
None
,
partials
=
None
,
**
kwargs
):
def
__init__
(
self
,
context
=
None
,
partials
=
None
,
**
kwargs
):
"""
Construct a View instance.
...
...
@@ -66,9 +66,6 @@ class View(object):
no template with that name, or raise an exception.
"""
if
template
is
not
None
:
self
.
template
=
template
context
=
Context
.
create
(
self
,
context
,
**
kwargs
)
self
.
_partials
=
partials
...
...
tests/test_examples.py
View file @
d14e40dd
...
...
@@ -37,12 +37,6 @@ class TestView(unittest.TestCase):
def
test_literal
(
self
):
self
.
assertEquals
(
Unescaped
()
.
render
(),
"<h1>Bear > Shark</h1>"
)
def
test_literal_sigil
(
self
):
view
=
Escaped
(
template
=
"<h1>{{& thing}}</h1>"
,
context
=
{
'thing'
:
'Bear > Giraffe'
})
self
.
assertEquals
(
view
.
render
(),
"<h1>Bear > Giraffe</h1>"
)
def
test_template_partial
(
self
):
self
.
assertEquals
(
TemplatePartial
()
.
render
(),
"""<h1>Welcome</h1>
Again, Welcome!"""
)
...
...
tests/test_renderengine.py
View file @
d14e40dd
...
...
@@ -92,6 +92,14 @@ class RenderTests(unittest.TestCase):
self
.
_assert_render
(
'BAR'
,
'{{{foo}}}'
,
{
'foo'
:
'bar'
},
engine
=
engine
)
def
test_literal__sigil
(
self
):
template
=
"<h1>{{& thing}}</h1>"
context
=
{
'thing'
:
'Bear > Giraffe'
}
expected
=
"<h1>Bear > Giraffe</h1>"
self
.
_assert_render
(
expected
,
template
,
context
)
def
test__escape
(
self
):
"""
Test that render() uses the escape attribute.
...
...
tests/test_view.py
View file @
d14e40dd
...
...
@@ -47,10 +47,6 @@ class ViewTestCase(unittest.TestCase):
view
=
View
(
context
=
context
,
fuzz
=
"buzz"
)
self
.
assertEquals
(
context
,
{
"foo"
:
"bar"
})
def
test_basic
(
self
):
view
=
Simple
(
"Hi {{thing}}!"
,
{
'thing'
:
'world'
})
self
.
assertEquals
(
view
.
render
(),
"Hi world!"
)
def
test_kwargs
(
self
):
view
=
Simple
(
"Hi {{thing}}!"
,
thing
=
'world'
)
self
.
assertEquals
(
view
.
render
(),
"Hi world!"
)
...
...
@@ -59,18 +55,6 @@ class ViewTestCase(unittest.TestCase):
view
=
Simple
(
thing
=
'world'
)
self
.
assertEquals
(
view
.
render
(),
"Hi world!"
)
def
test_render__partials
(
self
):
"""
Test passing partials to View.__init__().
"""
template
=
"{{>partial}}"
partials
=
{
"partial"
:
"Loaded from dictionary"
}
view
=
Simple
(
template
=
template
,
partials
=
partials
)
actual
=
view
.
render
()
self
.
assertEquals
(
actual
,
"Loaded from dictionary"
)
def
test_template_path
(
self
):
"""
Test that View.template_path is respected.
...
...
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