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
1e67ec66
Commit
1e67ec66
authored
Jun 13, 2016
by
Awais Jibran
Committed by
GitHub
Jun 13, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12702 from edx/aj/PLAT-1032-fix-export
Fix course export on edge
parents
fc885cbc
ba6ef624
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
2 deletions
+27
-2
cms/djangoapps/contentstore/tests/test_contentstore.py
+23
-0
common/lib/xmodule/xmodule/modulestore/xml_exporter.py
+4
-2
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
1e67ec66
...
@@ -735,6 +735,29 @@ class MiscCourseTests(ContentStoreTestCase):
...
@@ -735,6 +735,29 @@ class MiscCourseTests(ContentStoreTestCase):
# Remove tempdir
# Remove tempdir
shutil
.
rmtree
(
root_dir
)
shutil
.
rmtree
(
root_dir
)
@mock.patch
(
'lms.djangoapps.ccx.modulestore.CCXModulestoreWrapper.get_item'
,
mock
.
Mock
(
return_value
=
mock
.
Mock
(
children
=
[]))
)
def
test_export_with_orphan_vertical
(
self
):
"""
Tests that, export does not fail when a parent xblock does not have draft child xblock
information but the draft child xblock has parent information.
"""
# Make an existing unit a draft
self
.
store
.
convert_to_draft
(
self
.
problem
.
location
,
self
.
user
.
id
)
root_dir
=
path
(
mkdtemp_clean
())
export_course_to_xml
(
self
.
store
,
None
,
self
.
course
.
id
,
root_dir
,
'test_export'
)
# Verify that problem is exported in the drafts. This is expected because we are
# mocking get_item to for drafts. Expect no draft is exported.
# Specifically get_item is used in `xmodule.modulestore.xml_exporter._export_drafts`
export_draft_dir
=
OSFS
(
root_dir
/
'test_export/drafts'
)
self
.
assertEqual
(
len
(
export_draft_dir
.
listdir
()),
0
)
# Remove tempdir
shutil
.
rmtree
(
root_dir
)
def
test_assets_overwrite
(
self
):
def
test_assets_overwrite
(
self
):
""" Tests that assets will similar 'displayname' will be overwritten during export """
""" Tests that assets will similar 'displayname' will be overwritten during export """
content_store
=
contentstore
()
content_store
=
contentstore
()
...
...
common/lib/xmodule/xmodule/modulestore/xml_exporter.py
View file @
1e67ec66
...
@@ -41,7 +41,6 @@ def _export_drafts(modulestore, course_key, export_fs, xml_centric_course_key):
...
@@ -41,7 +41,6 @@ def _export_drafts(modulestore, course_key, export_fs, xml_centric_course_key):
# Check to see if the returned draft modules have changes w.r.t. the published module.
# Check to see if the returned draft modules have changes w.r.t. the published module.
# Only modules with changes will be exported into the /drafts directory.
# Only modules with changes will be exported into the /drafts directory.
draft_modules
=
[
module
for
module
in
draft_modules
if
modulestore
.
has_changes
(
module
)]
draft_modules
=
[
module
for
module
in
draft_modules
if
modulestore
.
has_changes
(
module
)]
if
draft_modules
:
if
draft_modules
:
draft_course_dir
=
export_fs
.
makeopendir
(
DRAFT_DIR
)
draft_course_dir
=
export_fs
.
makeopendir
(
DRAFT_DIR
)
...
@@ -85,9 +84,12 @@ def _export_drafts(modulestore, course_key, export_fs, xml_centric_course_key):
...
@@ -85,9 +84,12 @@ def _export_drafts(modulestore, course_key, export_fs, xml_centric_course_key):
continue
continue
logging
.
debug
(
'parent_loc =
%
s'
,
draft_node
.
parent_location
)
logging
.
debug
(
'parent_loc =
%
s'
,
draft_node
.
parent_location
)
draft_node
.
module
.
xml_attributes
[
'parent_url'
]
=
draft_node
.
parent_url
draft_node
.
module
.
xml_attributes
[
'parent_url'
]
=
draft_node
.
parent_url
parent
=
modulestore
.
get_item
(
draft_node
.
parent_location
)
parent
=
modulestore
.
get_item
(
draft_node
.
parent_location
)
# Don't try to export orphaned items
if
draft_node
.
module
.
location
not
in
parent
.
children
:
continue
index
=
parent
.
children
.
index
(
draft_node
.
module
.
location
)
index
=
parent
.
children
.
index
(
draft_node
.
module
.
location
)
draft_node
.
module
.
xml_attributes
[
'index_in_children_list'
]
=
str
(
index
)
draft_node
.
module
.
xml_attributes
[
'index_in_children_list'
]
=
str
(
index
)
...
...
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