Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
cd838e26
Commit
cd838e26
authored
11 years ago
by
chrisndodge
Browse files
Options
Downloads
Plain Diff
Merge pull request #644 from edx/fix/cdodge/remove-unused-import-code
remove unused code from xml_import.py
parents
86c7e2c4
05e1ffb1
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/lib/xmodule/xmodule/modulestore/xml_importer.py
+0
-54
0 additions, 54 deletions
common/lib/xmodule/xmodule/modulestore/xml_importer.py
with
0 additions
and
54 deletions
common/lib/xmodule/xmodule/modulestore/xml_importer.py
+
0
−
54
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
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment