Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
a5daf1f3
Commit
a5daf1f3
authored
12 years ago
by
Vik Paruchuri
Browse files
Options
Downloads
Patches
Plain Diff
Perhaps properly sanitize js
parent
6425a519
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/lib/xmodule/xmodule/open_ended_module.py
+1
-0
1 addition, 0 deletions
common/lib/xmodule/xmodule/open_ended_module.py
common/lib/xmodule/xmodule/openendedchild.py
+7
-0
7 additions, 0 deletions
common/lib/xmodule/xmodule/openendedchild.py
with
8 additions
and
0 deletions
common/lib/xmodule/xmodule/open_ended_module.py
+
1
−
0
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
)
...
...
This diff is collapsed.
Click to expand it.
common/lib/xmodule/xmodule/openendedchild.py
+
7
−
0
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
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment