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
fd3d97fd
Commit
fd3d97fd
authored
Dec 18, 2011
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed "it" to section_value.
parent
04631c05
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
pystache/template.py
+11
-11
No files found.
pystache/template.py
View file @
fd3d97fd
...
...
@@ -140,31 +140,31 @@ class Template(object):
section
,
section_key
,
inner
=
match
.
group
(
0
,
1
,
2
)
section_key
=
section_key
.
strip
()
it
=
self
.
context
.
get
(
section_key
,
None
)
section_value
=
self
.
context
.
get
(
section_key
,
None
)
replacer
=
''
# Callable
if
it
and
check_callable
(
it
):
replacer
=
it
(
inner
)
if
section_value
and
check_callable
(
section_value
):
replacer
=
section_value
(
inner
)
# Dictionary
elif
it
and
hasattr
(
it
,
'keys'
)
and
hasattr
(
it
,
'__getitem__'
):
elif
section_value
and
hasattr
(
section_value
,
'keys'
)
and
hasattr
(
section_value
,
'__getitem__'
):
if
section
[
2
]
!=
'^'
:
replacer
=
self
.
_render_dictionary
(
inner
,
it
)
replacer
=
self
.
_render_dictionary
(
inner
,
section_value
)
# Lists
elif
it
and
hasattr
(
it
,
'__iter__'
):
elif
section_value
and
hasattr
(
section_value
,
'__iter__'
):
if
section
[
2
]
!=
'^'
:
replacer
=
self
.
_render_list
(
inner
,
it
)
replacer
=
self
.
_render_list
(
inner
,
section_value
)
# Other objects
elif
it
and
isinstance
(
it
,
object
):
elif
section_value
and
isinstance
(
section_value
,
object
):
if
section
[
2
]
!=
'^'
:
replacer
=
self
.
_render_dictionary
(
inner
,
it
)
replacer
=
self
.
_render_dictionary
(
inner
,
section_value
)
# Falsey and Negated or Truthy and Not Negated
elif
(
not
it
and
section
[
2
]
==
'^'
)
or
(
it
and
section
[
2
]
!=
'^'
):
replacer
=
self
.
_render_dictionary
(
inner
,
it
)
elif
(
not
section_value
and
section
[
2
]
==
'^'
)
or
(
section_value
and
section
[
2
]
!=
'^'
):
replacer
=
self
.
_render_dictionary
(
inner
,
section_value
)
# Render template prior to section too
output
=
output
+
self
.
_render_tags
(
template
[
0
:
match
.
start
()])
+
replacer
...
...
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