fix: do not remove comments from XML during course import (#28557)
This is a follow-up to edx#1087, which reverted this change. According to the PR comments, parsing strings with XML comments inside them was causing errors. This does not seem to be the case anymore - these strings are just hidden when the block is rendered, but they are not breaking XBlocks. This also handles (ignores) the comments that could be added directly to the LibraryContentBlock in the XML export by users.
This commit is contained in:
@@ -1256,7 +1256,25 @@ class TestCourseExportImportProblem(CourseTestCase):
|
||||
|
||||
'<problem>\n <pre>\n <code>x=10 print("hello \n")</code>\n </pre>\n '
|
||||
'<multiplechoiceresponse/>\n</problem>\n'
|
||||
]
|
||||
],
|
||||
[
|
||||
'<!-- Comment outside of the root (will be deleted). -->'
|
||||
'<problem>'
|
||||
'<!-- Valid comment -->'
|
||||
'<p>'
|
||||
'"<!-- String with non-XML structure: >< -->"'
|
||||
'Text'
|
||||
'</p>'
|
||||
'</problem>',
|
||||
|
||||
'<problem>\n '
|
||||
'<!-- Valid comment -->\n '
|
||||
'<p>'
|
||||
'"<!-- String with non-XML structure: >< -->"'
|
||||
'Text'
|
||||
'</p>\n'
|
||||
'</problem>\n'
|
||||
],
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_problem_content_on_course_export_import(self, problem_data, expected_problem_content):
|
||||
|
||||
Reference in New Issue
Block a user