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
c1718296
Commit
c1718296
authored
Dec 18, 2011
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed "replacer" to "rendered".
parent
369faa88
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
pystache/template.py
+7
-7
No files found.
pystache/template.py
View file @
c1718296
...
@@ -148,33 +148,33 @@ class Template(object):
...
@@ -148,33 +148,33 @@ class Template(object):
section_key
=
section_key
.
strip
()
section_key
=
section_key
.
strip
()
section_value
=
self
.
context
.
get
(
section_key
,
None
)
section_value
=
self
.
context
.
get
(
section_key
,
None
)
re
placer
=
''
re
ndered
=
''
# Callable
# Callable
if
section_value
and
check_callable
(
section_value
):
if
section_value
and
check_callable
(
section_value
):
re
placer
=
section_value
(
section_contents
)
re
ndered
=
section_value
(
section_contents
)
# Dictionary
# Dictionary
elif
section_value
and
hasattr
(
section_value
,
'keys'
)
and
hasattr
(
section_value
,
'__getitem__'
):
elif
section_value
and
hasattr
(
section_value
,
'keys'
)
and
hasattr
(
section_value
,
'__getitem__'
):
if
section_type
!=
'^'
:
if
section_type
!=
'^'
:
re
placer
=
self
.
_render_dictionary
(
section_contents
,
section_value
)
re
ndered
=
self
.
_render_dictionary
(
section_contents
,
section_value
)
# Lists
# Lists
elif
section_value
and
hasattr
(
section_value
,
'__iter__'
):
elif
section_value
and
hasattr
(
section_value
,
'__iter__'
):
if
section_type
!=
'^'
:
if
section_type
!=
'^'
:
re
placer
=
self
.
_render_list
(
section_contents
,
section_value
)
re
ndered
=
self
.
_render_list
(
section_contents
,
section_value
)
# Other objects
# Other objects
elif
section_value
and
isinstance
(
section_value
,
object
):
elif
section_value
and
isinstance
(
section_value
,
object
):
if
section_type
!=
'^'
:
if
section_type
!=
'^'
:
re
placer
=
self
.
_render_dictionary
(
section_contents
,
section_value
)
re
ndered
=
self
.
_render_dictionary
(
section_contents
,
section_value
)
# Falsey and Negated or Truthy and Not Negated
# Falsey and Negated or Truthy and Not Negated
elif
(
not
section_value
and
section_type
==
'^'
)
or
(
section_value
and
section_type
!=
'^'
):
elif
(
not
section_value
and
section_type
==
'^'
)
or
(
section_value
and
section_type
!=
'^'
):
re
placer
=
self
.
_render_dictionary
(
section_contents
,
section_value
)
re
ndered
=
self
.
_render_dictionary
(
section_contents
,
section_value
)
# Render template prior to section too
# Render template prior to section too
output
.
append
(
re
placer
)
output
.
append
(
re
ndered
)
output
=
""
.
join
(
output
)
output
=
""
.
join
(
output
)
return
output
return
output
...
...
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