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
ff696a2f
Commit
ff696a2f
authored
Jul 28, 2014
by
Don Mitchell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4440 from edx/bug/import
Bug/import
parents
1bd6c711
e897b461
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
cms/djangoapps/contentstore/views/import_export.py
+3
-5
cms/djangoapps/contentstore/views/tests/test_import_export.py
+5
-3
No files found.
cms/djangoapps/contentstore/views/import_export.py
View file @
ff696a2f
...
@@ -210,17 +210,15 @@ def import_handler(request, course_key_string):
...
@@ -210,17 +210,15 @@ def import_handler(request, course_key_string):
status
=
415
status
=
415
)
)
logging
.
debug
(
'found course.xml at {0}'
.
format
(
dirpath
)
)
dirpath
=
os
.
path
.
relpath
(
dirpath
,
data_root
)
if
dirpath
!=
course_dir
:
logging
.
debug
(
'found course.xml at {0}'
.
format
(
dirpath
))
for
fname
in
os
.
listdir
(
dirpath
):
shutil
.
move
(
dirpath
/
fname
,
course_dir
)
_module_store
,
course_items
=
import_from_xml
(
_module_store
,
course_items
=
import_from_xml
(
modulestore
(),
modulestore
(),
request
.
user
.
id
,
request
.
user
.
id
,
settings
.
GITHUB_REPO_ROOT
,
settings
.
GITHUB_REPO_ROOT
,
[
course_subdir
],
[
dirpath
],
load_error_modules
=
False
,
load_error_modules
=
False
,
static_content_store
=
contentstore
(),
static_content_store
=
contentstore
(),
target_course_id
=
course_key
,
target_course_id
=
course_key
,
...
...
cms/djangoapps/contentstore/views/tests/test_import_export.py
View file @
ff696a2f
...
@@ -45,11 +45,13 @@ class ImportTestCase(CourseTestCase):
...
@@ -45,11 +45,13 @@ class ImportTestCase(CourseTestCase):
# Create tar test files -----------------------------------------------
# Create tar test files -----------------------------------------------
# OK course:
# OK course:
good_dir
=
tempfile
.
mkdtemp
(
dir
=
self
.
content_dir
)
good_dir
=
tempfile
.
mkdtemp
(
dir
=
self
.
content_dir
)
os
.
makedirs
(
os
.
path
.
join
(
good_dir
,
"course"
))
# test course being deeper down than top of tar file
with
open
(
os
.
path
.
join
(
good_dir
,
"course.xml"
),
"w+"
)
as
f
:
embedded_dir
=
os
.
path
.
join
(
good_dir
,
"grandparent"
,
"parent"
)
os
.
makedirs
(
os
.
path
.
join
(
embedded_dir
,
"course"
))
with
open
(
os
.
path
.
join
(
embedded_dir
,
"course.xml"
),
"w+"
)
as
f
:
f
.
write
(
'<course url_name="2013_Spring" org="EDx" course="0.00x"/>'
)
f
.
write
(
'<course url_name="2013_Spring" org="EDx" course="0.00x"/>'
)
with
open
(
os
.
path
.
join
(
goo
d_dir
,
"course"
,
"2013_Spring.xml"
),
"w+"
)
as
f
:
with
open
(
os
.
path
.
join
(
embedde
d_dir
,
"course"
,
"2013_Spring.xml"
),
"w+"
)
as
f
:
f
.
write
(
'<course></course>'
)
f
.
write
(
'<course></course>'
)
self
.
good_tar
=
os
.
path
.
join
(
self
.
content_dir
,
"good.tar.gz"
)
self
.
good_tar
=
os
.
path
.
join
(
self
.
content_dir
,
"good.tar.gz"
)
...
...
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