Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx
edx-platform
Commits
70a64aee
Commit
70a64aee
authored
Apr 12, 2016
by
Robert Raposa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix code review comment
parent
b5a674d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
scripts/safe_template_linter.py
+7
-9
No files found.
scripts/safe_template_linter.py
View file @
70a64aee
...
...
@@ -548,14 +548,12 @@ class ParseString(object):
The start index of the first single or double quote, or -1 if
no quote was found.
"""
double_quote_index
=
template
.
find
(
'"'
,
start_index
,
end_index
)
single_quote_index
=
template
.
find
(
"'"
,
start_index
,
end_index
)
if
0
<=
single_quote_index
or
0
<=
double_quote_index
:
if
0
<=
single_quote_index
and
0
<=
double_quote_index
:
return
min
(
single_quote_index
,
double_quote_index
)
else
:
return
max
(
single_quote_index
,
double_quote_index
)
return
-
1
quote_regex
=
re
.
compile
(
r"""['"]"""
)
start_match
=
quote_regex
.
search
(
template
,
start_index
,
end_index
)
if
start_match
is
None
:
return
-
1
else
:
return
start_match
.
start
()
def
_parse_string
(
self
,
template
,
start_index
):
"""
...
...
@@ -801,7 +799,7 @@ class MakoTemplateLinter(object):
close_paren_index
=
self
.
_find_closing_char_index
(
None
,
"("
,
")"
,
expression_inner
,
start_index
=
len
(
'HTML('
),
num_open_chars
=
0
,
strings
=
[]
)[
'close_char_index'
]
# check that the close paren is at the end of the expression.
# check that the close paren is at the end of the
stripped
expression.
if
close_paren_index
!=
len
(
expression_inner
)
-
1
:
results
.
violations
.
append
(
ExpressionRuleViolation
(
Rules
.
mako_html_alone
,
expression
...
...
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