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
3a351210
You need to sign in or sign up before continuing.
Commit
3a351210
authored
10 years ago
by
Mat Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Useless code path in import_from_xml causing errors removed
parent
f6d5d730
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 @
3a351210
...
...
@@ -48,7 +48,7 @@ class Command(BaseCommand):
mstore
,
data_dir
,
course_dirs
,
load_error_modules
=
False
,
static_content_store
=
contentstore
(),
verbose
=
True
,
do_import_static
=
do_import_static
,
create_new_course
=
True
,
create_new_course
_if_not_present
=
True
,
)
for
course
in
course_items
:
...
...
This diff is collapsed.
Click to expand it.
common/lib/xmodule/xmodule/modulestore/xml_importer.py
View file @
3a351210
...
...
@@ -111,7 +111,7 @@ def import_from_xml(
default_class
=
'xmodule.raw_module.RawDescriptor'
,
load_error_modules
=
True
,
static_content_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,
using org and course as the location org and course.
...
...
@@ -133,8 +133,8 @@ def import_from_xml(
time the course is loaded. Static content for some courses may also be
served directly by nginx, instead of going through django.
: create_new_course:
If True, then
courses whose ids already exist in the store are not imported
.
: create_new_course
_if_not_present
:
If True, then
a new course is created if it doesn't already exist
.
The check for existing courses is case-insensitive.
"""
...
...
@@ -165,24 +165,17 @@ def import_from_xml(
else
:
dest_course_id
=
course_key
if
create_new_course
:
# this tests if exactly this course (ignoring case) exists; so, it checks the run
if
store
.
has_course
(
dest_course_id
,
ignore_case
=
True
):
log
.
debug
(
"Skipping import of course with id, {0},"
"since it collides with an existing one"
.
format
(
dest_course_id
)
)
continue
else
:
try
:
store
.
create_course
(
dest_course_id
.
org
,
dest_course_id
.
offering
)
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
# Creates a new course if it doesn't already exist
if
create_new_course_if_not_present
and
not
store
.
has_course
(
dest_course_id
,
ignore_case
=
True
):
try
:
store
.
create_course
(
dest_course_id
.
org
,
dest_course_id
.
offering
)
except
InvalidLocationError
:
# course w/ same org and course exists
log
.
debug
(
"Skipping import of course with id, {0},"
"since it collides with an existing one"
.
format
(
dest_course_id
)
)
continue
try
:
# turn off all write signalling while importing as this
...
...
This diff is collapsed.
Click to expand it.
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