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
8ccd72c8
Commit
8ccd72c8
authored
Jun 20, 2014
by
Mathew Peterson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4158 from edx/mathewpeterson/course_import_fix
Useless code path in import_from_xml causing errors removed
parents
7ff3f08f
3a351210
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
22 deletions
+15
-22
cms/djangoapps/contentstore/management/commands/import.py
+1
-1
common/lib/xmodule/xmodule/modulestore/xml_importer.py
+14
-21
No files found.
cms/djangoapps/contentstore/management/commands/import.py
View file @
8ccd72c8
...
@@ -48,7 +48,7 @@ class Command(BaseCommand):
...
@@ -48,7 +48,7 @@ class Command(BaseCommand):
mstore
,
data_dir
,
course_dirs
,
load_error_modules
=
False
,
mstore
,
data_dir
,
course_dirs
,
load_error_modules
=
False
,
static_content_store
=
contentstore
(),
verbose
=
True
,
static_content_store
=
contentstore
(),
verbose
=
True
,
do_import_static
=
do_import_static
,
do_import_static
=
do_import_static
,
create_new_course
=
True
,
create_new_course
_if_not_present
=
True
,
)
)
for
course
in
course_items
:
for
course
in
course_items
:
...
...
common/lib/xmodule/xmodule/modulestore/xml_importer.py
View file @
8ccd72c8
...
@@ -111,7 +111,7 @@ def import_from_xml(
...
@@ -111,7 +111,7 @@ def import_from_xml(
default_class
=
'xmodule.raw_module.RawDescriptor'
,
default_class
=
'xmodule.raw_module.RawDescriptor'
,
load_error_modules
=
True
,
static_content_store
=
None
,
load_error_modules
=
True
,
static_content_store
=
None
,
target_course_id
=
None
,
verbose
=
False
,
draft_store
=
None
,
target_course_id
=
None
,
verbose
=
False
,
draft_store
=
None
,
do_import_static
=
True
,
create_new_course
=
False
):
do_import_static
=
True
,
create_new_course
_if_not_present
=
False
):
"""
"""
Import the specified xml data_dir into the "store" modulestore,
Import the specified xml data_dir into the "store" modulestore,
using org and course as the location org and course.
using org and course as the location org and course.
...
@@ -133,8 +133,8 @@ def import_from_xml(
...
@@ -133,8 +133,8 @@ def import_from_xml(
time the course is loaded. Static content for some courses may also be
time the course is loaded. Static content for some courses may also be
served directly by nginx, instead of going through django.
served directly by nginx, instead of going through django.
: create_new_course:
: create_new_course
_if_not_present
:
If True, then
courses whose ids already exist in the store are not imported
.
If True, then
a new course is created if it doesn't already exist
.
The check for existing courses is case-insensitive.
The check for existing courses is case-insensitive.
"""
"""
...
@@ -165,24 +165,17 @@ def import_from_xml(
...
@@ -165,24 +165,17 @@ def import_from_xml(
else
:
else
:
dest_course_id
=
course_key
dest_course_id
=
course_key
if
create_new_course
:
# Creates a new course if it doesn't already exist
# this tests if exactly this course (ignoring case) exists; so, it checks the run
if
create_new_course_if_not_present
and
not
store
.
has_course
(
dest_course_id
,
ignore_case
=
True
):
if
store
.
has_course
(
dest_course_id
,
ignore_case
=
True
):
try
:
log
.
debug
(
store
.
create_course
(
dest_course_id
.
org
,
dest_course_id
.
offering
)
"Skipping import of course with id, {0},"
except
InvalidLocationError
:
"since it collides with an existing one"
.
format
(
dest_course_id
)
# course w/ same org and course exists
)
log
.
debug
(
continue
"Skipping import of course with id, {0},"
else
:
"since it collides with an existing one"
.
format
(
dest_course_id
)
try
:
)
store
.
create_course
(
dest_course_id
.
org
,
dest_course_id
.
offering
)
continue
except
InvalidLocationError
:
# course w/ same org and course exists and store is old mongo
log
.
debug
(
"Skipping import of course with id, {0},"
"since it collides with an existing one"
.
format
(
dest_course_id
)
)
continue
try
:
try
:
# turn off all write signalling while importing as this
# turn off all write signalling while importing as this
...
...
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