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
cba3c79c
Commit
cba3c79c
authored
Jan 14, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed a RenderEngine._parse() argument from template_string to template.
parent
5189316b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
pystache/parser.py
+4
-0
pystache/renderengine.py
+14
-6
No files found.
pystache/parser.py
View file @
cba3c79c
...
...
@@ -79,6 +79,10 @@ class Parser(object):
This method uses the current tag delimiter.
Arguments:
template: a template string of type unicode.
"""
parse_tree
=
[]
start_index
=
index
...
...
pystache/renderengine.py
View file @
cba3c79c
...
...
@@ -172,7 +172,7 @@ class RenderEngine(object):
elif
callable
(
data
):
# TODO: should we check the arity?
template
=
data
(
template
)
parsed_template
=
self
.
_parse
(
template
_string
=
template
,
delimiters
=
delims
)
parsed_template
=
self
.
_parse
(
template
,
delimiters
=
delims
)
data
=
[
data
]
elif
type
(
data
)
not
in
[
list
,
tuple
]:
data
=
[
data
]
...
...
@@ -187,15 +187,19 @@ class RenderEngine(object):
return
get_section
def
_parse
(
self
,
template
_string
,
delimiters
=
None
):
def
_parse
(
self
,
template
,
delimiters
=
None
):
"""
Parse the given template, and return a ParsedTemplate instance.
Arguments:
template: a template string of type unicode.
"""
parser
=
Parser
(
self
,
delimiters
=
delimiters
)
parser
.
compile_template_re
()
return
parser
.
parse
(
template
=
template
_string
)
return
parser
.
parse
(
template
=
template
)
def
_render
(
self
,
template
,
context
):
"""
...
...
@@ -203,14 +207,18 @@ class RenderEngine(object):
Arguments:
template:
template string
context: a Context instance
template:
a template string of type unicode.
context: a Context instance
.
"""
# We keep this type-check as an added check because this method is
# called with template strings coming from potentially externally-
# supplied functions like self.literal, self.load_partial, etc.
# Beyond this point, we have much better control over the type.
if
type
(
template
)
is
not
unicode
:
raise
Exception
(
"Argument 'template' not unicode:
%
s:
%
s"
%
(
type
(
template
),
repr
(
template
)))
parsed_template
=
self
.
_parse
(
template
_string
=
template
)
parsed_template
=
self
.
_parse
(
template
)
return
parsed_template
.
render
(
context
)
...
...
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