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
70c77f48
Commit
70c77f48
authored
Aug 04, 2014
by
Nimisha Asthagiri
Committed by
Don Mitchell
Aug 08, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup - re-enable Asset checking.
parent
9254cfa9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
45 deletions
+51
-45
common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py
+8
-0
common/lib/xmodule/xmodule/modulestore/xml_importer.py
+40
-38
common/lib/xmodule/xmodule/tests/__init__.py
+3
-7
No files found.
common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py
View file @
70c77f48
...
...
@@ -33,6 +33,14 @@ class DraftVersioningModuleStore(ModuleStoreDraftAndPublished, SplitMongoModuleS
org
,
course
,
run
,
user_id
,
master_branch
=
master_branch
,
**
kwargs
)
self
.
_auto_publish_no_children
(
item
.
location
,
item
.
location
.
category
,
user_id
,
**
kwargs
)
# create any other necessary things as a side effect: ensure they populate the draft branch
# and rely on auto publish to populate the published branch
with
self
.
branch_setting
(
ModuleStoreEnum
.
Branch
.
draft_preferred
,
item
.
id
):
super
(
SplitMongoModuleStore
,
self
)
.
create_course
(
org
,
course
,
run
,
user_id
,
**
kwargs
)
return
item
def
get_course
(
self
,
course_id
,
depth
=
0
):
...
...
common/lib/xmodule/xmodule/modulestore/xml_importer.py
View file @
70c77f48
...
...
@@ -303,48 +303,50 @@ def _import_course_module(
log
.
debug
(
'course data_dir={0}'
.
format
(
source_course
.
data_dir
))
course
=
_import_module_and_update_references
(
source_course
,
store
,
user_id
,
course_key
,
dest_course_id
,
do_import_static
=
do_import_static
,
runtime
=
runtime
,
)
with
store
.
branch_setting
(
ModuleStoreEnum
.
Branch
.
draft_preferred
,
dest_course_id
):
for
entry
in
course
.
pdf_textbooks
:
for
chapter
in
entry
.
get
(
'chapters'
,
[]):
if
StaticContent
.
is_c4x_path
(
chapter
.
get
(
'url'
,
''
)):
asset_key
=
StaticContent
.
get_location_from_path
(
chapter
[
'url'
])
chapter
[
'url'
]
=
StaticContent
.
get_static_path_from_location
(
asset_key
)
# Original wiki_slugs had value location.course. To make them unique this was changed to 'org.course.name'.
# If we are importing into a course with a different course_id and wiki_slug is equal to either of these default
# values then remap it so that the wiki does not point to the old wiki.
if
course_key
!=
course
.
id
:
original_unique_wiki_slug
=
u'{0}.{1}.{2}'
.
format
(
course_key
.
org
,
course_key
.
course
,
course_key
.
run
course
=
_import_module_and_update_references
(
source_course
,
store
,
user_id
,
course_key
,
dest_course_id
,
do_import_static
=
do_import_static
,
runtime
=
runtime
,
)
if
course
.
wiki_slug
==
original_unique_wiki_slug
or
course
.
wiki_slug
==
course_key
.
course
:
course
.
wiki_slug
=
u'{0}.{1}.{2}'
.
format
(
course
.
id
.
org
,
course
.
id
.
course
,
course
.
id
.
run
,
for
entry
in
course
.
pdf_textbooks
:
for
chapter
in
entry
.
get
(
'chapters'
,
[]):
if
StaticContent
.
is_c4x_path
(
chapter
.
get
(
'url'
,
''
)):
asset_key
=
StaticContent
.
get_location_from_path
(
chapter
[
'url'
])
chapter
[
'url'
]
=
StaticContent
.
get_static_path_from_location
(
asset_key
)
# Original wiki_slugs had value location.course. To make them unique this was changed to 'org.course.name'.
# If we are importing into a course with a different course_id and wiki_slug is equal to either of these default
# values then remap it so that the wiki does not point to the old wiki.
if
course_key
!=
course
.
id
:
original_unique_wiki_slug
=
u'{0}.{1}.{2}'
.
format
(
course_key
.
org
,
course_key
.
course
,
course_key
.
run
)
if
course
.
wiki_slug
==
original_unique_wiki_slug
or
course
.
wiki_slug
==
course_key
.
course
:
course
.
wiki_slug
=
u'{0}.{1}.{2}'
.
format
(
course
.
id
.
org
,
course
.
id
.
course
,
course
.
id
.
run
,
)
# cdodge: more hacks (what else). Seems like we have a
# problem when importing a course (like 6.002) which
# does not have any tabs defined in the policy file.
# The import goes fine and then displays fine in LMS,
# but if someone tries to add a new tab in the CMS, then
# the LMS barfs because it expects that -- if there are
# *any* tabs -- then there at least needs to be
# some predefined ones
if
course
.
tabs
is
None
or
len
(
course
.
tabs
)
==
0
:
CourseTabList
.
initialize_default
(
course
)
store
.
update_item
(
course
,
user_id
)
# cdodge: more hacks (what else). Seems like we have a
# problem when importing a course (like 6.002) which
# does not have any tabs defined in the policy file.
# The import goes fine and then displays fine in LMS,
# but if someone tries to add a new tab in the CMS, then
# the LMS barfs because it expects that -- if there are
# *any* tabs -- then there at least needs to be
# some predefined ones
if
course
.
tabs
is
None
or
len
(
course
.
tabs
)
==
0
:
CourseTabList
.
initialize_default
(
course
)
store
.
update_item
(
course
,
user_id
)
return
course
,
course_data_path
...
...
common/lib/xmodule/xmodule/tests/__init__.py
View file @
70c77f48
...
...
@@ -203,12 +203,12 @@ class CourseComparisonTest(unittest.TestCase):
self
.
_assertCoursesEqual
(
expected_items
,
actual_items
,
actual_course_key
)
# compare draft
if
expected_store
.
get_modulestore_type
()
==
ModuleStoreEnum
.
Type
.
split
:
if
expected_store
.
get_modulestore_type
(
None
)
==
ModuleStoreEnum
.
Type
.
split
:
revision
=
ModuleStoreEnum
.
RevisionOption
.
draft_only
else
:
revision
=
None
expected_items
=
expected_store
.
get_items
(
expected_course_key
,
revision
=
revision
)
if
actual_store
.
get_modulestore_type
()
==
ModuleStoreEnum
.
Type
.
split
:
if
actual_store
.
get_modulestore_type
(
None
)
==
ModuleStoreEnum
.
Type
.
split
:
revision
=
ModuleStoreEnum
.
RevisionOption
.
draft_only
else
:
revision
=
None
...
...
@@ -276,10 +276,7 @@ class CourseComparisonTest(unittest.TestCase):
# get_children was returning drafts for published parents :-(
if
expect_drafts
or
not
getattr
(
item_child
,
'is_draft'
,
False
)
]
try
:
self
.
assertEqual
(
expected_children
,
actual_children
)
except
:
pass
self
.
assertEqual
(
expected_children
,
actual_children
)
def
assertAssetEqual
(
self
,
expected_course_key
,
expected_asset
,
actual_course_key
,
actual_asset
):
"""
...
...
@@ -319,7 +316,6 @@ class CourseComparisonTest(unittest.TestCase):
``actual_course_key`` in ``actual_store`` are identical, allowing for differences related
to their being from different course keys.
"""
return
# FIXME remove
expected_content
,
expected_count
=
expected_store
.
get_all_content_for_course
(
expected_course_key
)
actual_content
,
actual_count
=
actual_store
.
get_all_content_for_course
(
actual_course_key
)
...
...
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