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
6d2688cb
Commit
6d2688cb
authored
Dec 06, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unicode fix and cleanup in stringify children
parent
0bc06579
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
11 deletions
+5
-11
common/lib/capa/capa/responsetypes.py
+5
-11
No files found.
common/lib/capa/capa/responsetypes.py
View file @
6d2688cb
...
...
@@ -1845,24 +1845,18 @@ class OpenEndedResponse(LoncapaResponse):
rubric
=
self
.
xml
.
find
(
'openendedrubric'
)
self
.
_parse
(
oeparam
,
prompt
,
rubric
)
def
stringify_children
(
self
,
node
,
strip_tags
=
True
):
@staticmethod
def
stringify_children
(
node
):
"""
Modify code from stringify_children in xmodule. Didn't import directly
in order to avoid capa depending on xmodule (seems to be avoided in
code)
"""
parts
=
[
node
.
text
]
[
parts
.
append
((
etree
.
tostring
(
p
,
with_tail
=
True
)))
for
p
in
node
.
getchildren
()]
node_string
=
' '
.
join
(
parts
)
for
p
in
node
.
getchildren
():
parts
.
append
(
etree
.
tostring
(
p
,
with_tail
=
True
,
encoding
=
'unicode'
)
)
# Strip html tags from result. This may need to be removed in order to
# display prompt to instructors properly.
# TODO: what breaks if this is removed? The ML code can strip tags
# as part of its input filtering.
if
strip_tags
:
node_string
=
re
.
sub
(
'<[^<]+?>'
,
''
,
node_string
)
return
node_string
return
' '
.
join
(
parts
)
def
_parse
(
self
,
oeparam
,
prompt
,
rubric
):
'''
...
...
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