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
b25dc54d
Commit
b25dc54d
authored
Aug 22, 2016
by
Qubad786
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update library content block's children on branches
parent
2e8e51c3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
10 deletions
+31
-10
cms/djangoapps/contentstore/views/tests/test_import_export.py
+19
-5
common/lib/xmodule/xmodule/modulestore/xml_importer.py
+12
-5
No files found.
cms/djangoapps/contentstore/views/tests/test_import_export.py
View file @
b25dc54d
...
...
@@ -756,7 +756,7 @@ class TestCourseExportImport(LibraryTestCase):
return
self
.
get_lib_content_block_children
(
self
.
store
.
get_item
(
block_location
)
.
children
[
0
])
def
assert_problem_display_names
(
self
,
source_course_location
,
dest_course_location
):
def
assert_problem_display_names
(
self
,
source_course_location
,
dest_course_location
,
is_published
):
"""
Asserts that problems' display names in both source and destination courses are same.
"""
...
...
@@ -766,9 +766,22 @@ class TestCourseExportImport(LibraryTestCase):
self
.
assertEquals
(
len
(
source_course_lib_children
),
len
(
dest_course_lib_children
))
for
source_child_location
,
dest_child_location
in
zip
(
source_course_lib_children
,
dest_course_lib_children
):
source_child
=
self
.
store
.
get_item
(
source_child_location
)
dest_child
=
self
.
store
.
get_item
(
dest_child_location
)
self
.
assertEquals
(
source_child
.
display_name
,
dest_child
.
display_name
)
# Assert problem names on draft branch.
with
self
.
store
.
branch_setting
(
branch_setting
=
ModuleStoreEnum
.
Branch
.
draft_preferred
):
self
.
assert_names
(
source_child_location
,
dest_child_location
)
if
is_published
:
# Assert problem names on publish branch.
with
self
.
store
.
branch_setting
(
branch_setting
=
ModuleStoreEnum
.
Branch
.
published_only
):
self
.
assert_names
(
source_child_location
,
dest_child_location
)
def
assert_names
(
self
,
source_child_location
,
dest_child_location
):
"""
Check if blocks have same display_name.
"""
source_child
=
self
.
store
.
get_item
(
source_child_location
)
dest_child
=
self
.
store
.
get_item
(
dest_child_location
)
self
.
assertEquals
(
source_child
.
display_name
,
dest_child
.
display_name
)
@ddt.data
(
True
,
False
)
def
test_library_content_on_course_export_import
(
self
,
publish_item
):
...
...
@@ -805,5 +818,6 @@ class TestCourseExportImport(LibraryTestCase):
self
.
assert_problem_display_names
(
self
.
source_course
.
location
,
dest_course
.
location
dest_course
.
location
,
publish_item
)
common/lib/xmodule/xmodule/modulestore/xml_importer.py
View file @
b25dc54d
...
...
@@ -753,11 +753,18 @@ def _update_and_import_module(
# if library exists, update source_library_version and children
# according to this existing library and library content block.
if
store
.
get_library
(
block
.
source_library_key
):
LibraryToolsService
(
store
)
.
update_children
(
block
,
user_id
,
version
=
block
.
source_library_version
)
# Update library content block's children on draft branch
with
store
.
branch_setting
(
branch_setting
=
ModuleStoreEnum
.
Branch
.
draft_preferred
):
LibraryToolsService
(
store
)
.
update_children
(
block
,
user_id
,
version
=
block
.
source_library_version
)
# Publish it if importing the course for branch setting published_only.
if
store
.
get_branch_setting
()
==
ModuleStoreEnum
.
Branch
.
published_only
:
store
.
publish
(
block
.
location
,
user_id
)
return
block
...
...
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