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
04176645
Commit
04176645
authored
Dec 29, 2011
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Renderer._render_object() method.
parent
3b47fddc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
pystache/renderer.py
+14
-4
No files found.
pystache/renderer.py
View file @
04176645
...
...
@@ -286,6 +286,16 @@ class Renderer(object):
return
unicode
(
rendered
)
def
_render_object
(
self
,
obj
,
*
context
,
**
kwargs
):
"""
Render the template associated with the given object.
"""
context
=
[
obj
]
+
list
(
context
)
template
=
self
.
get_associated_template
(
obj
)
return
self
.
_render_string
(
template
,
*
context
,
**
kwargs
)
def
render_path
(
self
,
template_path
,
*
context
,
**
kwargs
):
"""
Render the template at the given path using the given context.
...
...
@@ -294,7 +304,8 @@ class Renderer(object):
"""
template
=
self
.
read
(
template_path
)
return
self
.
render
(
template
,
*
context
,
**
kwargs
)
return
self
.
_render_string
(
template
,
*
context
,
**
kwargs
)
def
render
(
self
,
template
,
*
context
,
**
kwargs
):
"""
...
...
@@ -328,8 +339,7 @@ class Renderer(object):
"""
if
not
isinstance
(
template
,
basestring
):
# Then we assume the template is an object instance.
context
=
[
template
]
+
list
(
context
)
template
=
self
.
get_associated_template
(
template
)
# Then we assume the template is an object.
return
self
.
_render_object
(
template
,
*
context
,
**
kwargs
)
return
self
.
_render_string
(
template
,
*
context
,
**
kwargs
)
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