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
dbb50631
Commit
dbb50631
authored
Oct 29, 2009
by
Eric Florenzano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Flattened the render_sections loop
parent
8303869d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
pystache/template.py
+14
-12
No files found.
pystache/template.py
View file @
dbb50631
...
...
@@ -29,18 +29,20 @@ class Template(object):
break
section
,
section_name
,
inner
=
match
.
group
(
0
,
1
,
2
)
if
section_name
in
context
and
context
[
section_name
]:
if
hasattr
(
context
[
section_name
],
'__iter__'
):
insides
=
[]
for
item
in
context
[
section_name
]:
ctx
=
context
.
copy
()
ctx
.
update
(
item
)
insides
.
append
(
self
.
render
(
inner
,
ctx
))
template
=
template
.
replace
(
section
,
''
.
join
(
insides
))
else
:
template
=
template
.
replace
(
section
,
inner
)
else
:
template
=
template
.
replace
(
section
,
''
)
it
=
context
.
get
(
section_name
)
replacer
=
''
if
it
and
not
hasattr
(
it
,
'__iter__'
):
replacer
=
inner
elif
it
:
insides
=
[]
for
item
in
context
[
section_name
]:
ctx
=
context
.
copy
()
ctx
.
update
(
item
)
insides
.
append
(
self
.
render
(
inner
,
ctx
))
replacer
=
''
.
join
(
insides
)
template
=
template
.
replace
(
section
,
replacer
)
return
template
...
...
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