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
a5daf1f3
Commit
a5daf1f3
authored
Jan 24, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Perhaps properly sanitize js
parent
6425a519
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
common/lib/xmodule/xmodule/open_ended_module.py
+1
-0
common/lib/xmodule/xmodule/openendedchild.py
+7
-0
No files found.
common/lib/xmodule/xmodule/open_ended_module.py
View file @
a5daf1f3
...
...
@@ -554,6 +554,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
# add new history element with answer and empty score and hint.
self
.
new_history_entry
(
get
[
'student_answer'
])
get
[
'student_answer'
]
=
self
.
sanitize_html
(
get
[
'student_answer'
])
self
.
send_to_grader
(
get
[
'student_answer'
],
system
)
self
.
change_state
(
self
.
ASSESSING
)
...
...
common/lib/xmodule/xmodule/openendedchild.py
View file @
a5daf1f3
...
...
@@ -5,6 +5,7 @@ import json
import
logging
from
lxml
import
etree
from
lxml.html
import
rewrite_links
from
lxml.html.clean
import
Cleaner
from
path
import
path
import
os
import
sys
...
...
@@ -130,12 +131,18 @@ class OpenEndedChild(object):
return
""
return
self
.
history
[
-
1
]
.
get
(
'post_assessment'
,
""
)
def
sanitize_html
(
self
,
answer
):
cleaner
=
Cleaner
(
style
=
True
,
links
=
True
,
add_nofollow
=
True
,
page_structure
=
True
,
safe_attrs_only
=
True
)
clean_html
=
cleaner
.
clean_html
(
answer
)
return
clean_html
def
new_history_entry
(
self
,
answer
):
"""
Adds a new entry to the history dictionary
@param answer: The student supplied answer
@return: None
"""
answer
=
self
.
sanitize_html
(
answer
)
self
.
history
.
append
({
'answer'
:
answer
})
def
record_latest_score
(
self
,
score
):
...
...
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