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
5a7bcd7b
Commit
5a7bcd7b
authored
Aug 20, 2013
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
always serialize out HTML content to a separate .html file
parent
e79f8c43
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
6 deletions
+27
-6
cms/djangoapps/contentstore/tests/test_contentstore.py
+25
-0
common/lib/xmodule/xmodule/html_module.py
+1
-6
common/test/data/toy/course/2012_Fall.xml
+1
-0
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
5a7bcd7b
...
...
@@ -1057,6 +1057,31 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
# It should now contain empty data
self
.
assertEquals
(
imported_word_cloud
.
data
,
''
)
def
test_html_export_roundtrip
(
self
):
"""
Test that a course which has HTML that has style formatting is preserved in export/import
"""
module_store
=
modulestore
(
'direct'
)
content_store
=
contentstore
()
import_from_xml
(
module_store
,
'common/test/data/'
,
[
'toy'
])
location
=
CourseDescriptor
.
id_to_location
(
'edX/toy/2012_Fall'
)
# Export the course
root_dir
=
path
(
mkdtemp_clean
())
export_to_xml
(
module_store
,
content_store
,
location
,
root_dir
,
'test_roundtrip'
)
# Reimport and get the video back
import_from_xml
(
module_store
,
root_dir
)
# get the sample HTML with styling information
html_module
=
module_store
.
get_instance
(
'edX/toy/2012_Fall'
,
Location
([
'i4x'
,
'edX'
,
'toy'
,
'html'
,
'with_styling'
])
)
self
.
assertIn
(
'<p style="font:italic bold 72px/30px Georgia, serif; color: red; ">'
,
html_module
.
data
)
def
test_course_handouts_rewrites
(
self
):
module_store
=
modulestore
(
'direct'
)
...
...
common/lib/xmodule/xmodule/html_module.py
View file @
5a7bcd7b
...
...
@@ -164,14 +164,9 @@ class HtmlDescriptor(HtmlFields, XmlDescriptor, EditingDescriptor):
# TODO (vshnayder): make export put things in the right places.
def
definition_to_xml
(
self
,
resource_fs
):
'''If the contents are valid xml, write them to filename.xml. Otherwise,
write just <html filename="" [meta-attrs="..."]> to filename.xml, and the html
''' Write <html filename="" [meta-attrs="..."]> to filename.xml, and the html
string to filename.html.
'''
try
:
return
etree
.
fromstring
(
self
.
data
)
except
etree
.
XMLSyntaxError
:
pass
# Not proper format. Write html to file, return an empty tag
pathname
=
name_to_pathname
(
self
.
url_name
)
...
...
common/test/data/toy/course/2012_Fall.xml
View file @
5a7bcd7b
...
...
@@ -8,6 +8,7 @@
<html
url_name=
"nonportable"
/>
<html
url_name=
"nonportable_link"
/>
<html
url_name=
"badlink"
/>
<html
url_name=
"with_styling"
/>
<video
url_name=
"Video_Resources"
youtube_id_1_0=
"1bK-WdDi6Qw"
display_name=
"Video Resources"
/>
</videosequence>
<video
url_name=
"Welcome"
youtube_id_1_0=
"p2Q6BrNhdh8"
display_name=
"Welcome"
/>
...
...
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