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
b7c830a8
Commit
b7c830a8
authored
Oct 25, 2012
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use existing _replace() method on Location to do the re-namespacing on import
parent
ba157352
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
common/lib/xmodule/xmodule/modulestore/xml_importer.py
+10
-5
No files found.
common/lib/xmodule/xmodule/modulestore/xml_importer.py
View file @
b7c830a8
...
@@ -105,9 +105,12 @@ def import_from_xml(store, data_dir, course_dirs=None,
...
@@ -105,9 +105,12 @@ def import_from_xml(store, data_dir, course_dirs=None,
# This looks a bit wonky as we need to also change the 'name' of the imported course to be what
# This looks a bit wonky as we need to also change the 'name' of the imported course to be what
# the caller passed in
# the caller passed in
module
.
location
=
Location
(
target_location_namespace
.
tag
,
if
module
.
location
.
category
!=
'course'
:
target_location_namespace
.
org
,
target_location_namespace
.
course
,
module
.
location
.
category
,
module
.
location
=
module
.
location
.
_replace
(
tag
=
target_location_namespace
.
tag
,
org
=
target_location_namespace
.
org
,
module
.
location
.
name
if
module
.
location
.
category
!=
'course'
else
target_location_namespace
.
name
)
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
# then remap children pointers since they too will be re-namespaced
children_locs
=
module
.
definition
.
get
(
'children'
)
children_locs
=
module
.
definition
.
get
(
'children'
)
...
@@ -115,8 +118,10 @@ def import_from_xml(store, data_dir, course_dirs=None,
...
@@ -115,8 +118,10 @@ def import_from_xml(store, data_dir, course_dirs=None,
new_locs
=
[]
new_locs
=
[]
for
child
in
children_locs
:
for
child
in
children_locs
:
child_loc
=
Location
(
child
)
child_loc
=
Location
(
child
)
new_locs
.
append
(
Location
(
target_location_namespace
.
tag
,
target_location_namespace
.
org
,
new_child_loc
=
child_loc
.
_replace
(
tag
=
target_location_namespace
.
tag
,
org
=
target_location_namespace
.
org
,
target_location_namespace
.
course
,
child_loc
.
category
,
child_loc
.
name
)
.
url
())
course
=
target_location_namespace
.
course
)
new_locs
.
append
(
new_child_loc
)
module
.
definition
[
'children'
]
=
new_locs
module
.
definition
[
'children'
]
=
new_locs
...
...
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