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
65646c81
Commit
65646c81
authored
Nov 16, 2009
by
Joshua Roesslein
Committed by
Chris Wanstrath
Nov 16, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow using View instances as attributes.
parent
f03c85c7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
0 deletions
+11
-0
HISTORY.md
+1
-0
pystache/view.py
+3
-0
tests/test_view.py
+7
-0
No files found.
HISTORY.md
View file @
65646c81
## 0.2.0 (2009-11-16)
*
Add support for using non-callables as View attributes.
[
joshthecoder
]
*
Allow using View instances as attributes.
[
joshthecoder
]
## 0.1.1 (2009-11-13)
...
...
pystache/view.py
View file @
65646c81
...
...
@@ -89,3 +89,6 @@ class View(object):
def
render
(
self
):
template
=
self
.
load_template
()
return
Template
(
template
,
self
)
.
render
()
def
__str__
(
self
):
return
self
.
render
()
tests/test_view.py
View file @
65646c81
...
...
@@ -26,6 +26,13 @@ class TestView(unittest.TestCase):
view
.
thing
=
'Chris'
self
.
assertEquals
(
view
.
render
(),
"Hi Chris!"
)
def
test_view_instances_as_attributes
(
self
):
other
=
Simple
(
name
=
'chris'
)
other
.
template
=
'{{name}}'
view
=
Simple
()
view
.
thing
=
other
self
.
assertEquals
(
view
.
render
(),
"Hi chris!"
)
def
test_complex
(
self
):
self
.
assertEquals
(
ComplexView
()
.
render
(),
"""<h1>Colors</h1>
<ul>
...
...
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