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
cd838e26
Commit
cd838e26
authored
Aug 13, 2013
by
chrisndodge
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #644 from edx/fix/cdodge/remove-unused-import-code
remove unused code from xml_import.py
parents
86c7e2c4
05e1ffb1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
54 deletions
+0
-54
common/lib/xmodule/xmodule/modulestore/xml_importer.py
+0
-54
No files found.
common/lib/xmodule/xmodule/modulestore/xml_importer.py
View file @
cd838e26
...
...
@@ -490,57 +490,3 @@ def perform_xlint(data_dir, course_dirs,
print
"This course can be imported successfully."
return
err_cnt
#
# UNSURE IF THIS IS UNUSED CODE - IF SO NEEDS TO BE PRUNED. TO BE INVESTIGATED.
#
def
import_module_from_xml
(
modulestore
,
static_content_store
,
course_data_path
,
module
,
target_location_namespace
=
None
,
verbose
=
False
):
# remap module to the new namespace
if
target_location_namespace
is
not
None
:
# This looks a bit wonky as we need to also change the 'name' of the imported course to be what
# the caller passed in
if
module
.
location
.
category
!=
'course'
:
module
.
location
=
module
.
location
.
_replace
(
tag
=
target_location_namespace
.
tag
,
org
=
target_location_namespace
.
org
,
course
=
target_location_namespace
.
course
)
else
:
module
.
location
=
module
.
location
.
_replace
(
tag
=
target_location_namespace
.
tag
,
org
=
target_location_namespace
.
org
,
course
=
target_location_namespace
.
course
,
name
=
target_location_namespace
.
name
)
# then remap children pointers since they too will be re-namespaced
if
module
.
has_children
:
children_locs
=
module
.
children
new_locs
=
[]
for
child
in
children_locs
:
child_loc
=
Location
(
child
)
new_child_loc
=
child_loc
.
_replace
(
tag
=
target_location_namespace
.
tag
,
org
=
target_location_namespace
.
org
,
course
=
target_location_namespace
.
course
)
new_locs
.
append
(
new_child_loc
.
url
())
module
.
children
=
new_locs
if
hasattr
(
module
,
'data'
):
modulestore
.
update_item
(
module
.
location
,
module
.
data
)
if
module
.
has_children
:
modulestore
.
update_children
(
module
.
location
,
module
.
children
)
modulestore
.
update_metadata
(
module
.
location
,
own_metadata
(
module
))
def
import_course_from_xml
(
modulestore
,
static_content_store
,
course_data_path
,
module
,
target_location_namespace
=
None
,
verbose
=
False
):
# CDODGE: Is this unused code (along with import_module_from_xml)? I can't find any references to it. If so, then
# we need to delete this apparently duplicate code.
# 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 is *any* tabs - then there at least needs to be some predefined ones
if
module
.
tabs
is
None
or
len
(
module
.
tabs
)
==
0
:
module
.
tabs
=
[{
"type"
:
"courseware"
},
{
"type"
:
"course_info"
,
"name"
:
"Course Info"
},
{
"type"
:
"discussion"
,
"name"
:
"Discussion"
},
{
"type"
:
"wiki"
,
"name"
:
"Wiki"
}]
# note, add 'progress' when we can support it on Edge
import_module_from_xml
(
modulestore
,
static_content_store
,
course_data_path
,
module
,
target_location_namespace
,
verbose
=
verbose
)
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