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
5cbdd5de
Commit
5cbdd5de
authored
Jun 28, 2017
by
Jeremy Bowman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PLAT-1323 Remove older, slower code path for course export
parent
a4226471
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
32 deletions
+3
-32
cms/djangoapps/contentstore/views/import_export.py
+3
-18
cms/djangoapps/contentstore/views/tests/test_import_export.py
+0
-14
No files found.
cms/djangoapps/contentstore/views/import_export.py
View file @
5cbdd5de
...
...
@@ -292,21 +292,12 @@ def export_handler(request, course_key_string):
GET
html: return html page for import page
application/x-tgz: return tar.gz file containing exported course
json: not supported
POST
Start a Celery task to export the course
Note that there are 3 ways to request the tar.gz file. The Studio UI uses
a POST request to start the export asynchronously, with a link appearing
on the page once it's ready. Additionally, for backwards compatibility
reasons the request header can specify application/x-tgz via HTTP_ACCEPT,
or a query parameter can be used (?_accept=application/x-tgz); this will
export the course synchronously and return the resulting file (unless the
request times out for a large course).
If the tar.gz file has been requested but the export operation fails, the
import page will be returned including a description of the error.
The Studio UI uses a POST request to start the export asynchronously, with
a link appearing on the page once it's ready.
"""
course_key
=
CourseKey
.
from_string
(
course_key_string
)
if
not
has_course_author_access
(
request
.
user
,
course_key
):
...
...
@@ -336,16 +327,10 @@ def export_handler(request, course_key_string):
if
request
.
method
==
'POST'
:
export_olx
.
delay
(
request
.
user
.
id
,
course_key_string
,
request
.
LANGUAGE_CODE
)
return
JsonResponse
({
'ExportStatus'
:
1
})
elif
'application/x-tgz'
in
requested_format
:
try
:
tarball
=
create_export_tarball
(
courselike_module
,
course_key
,
context
)
return
send_tarball
(
tarball
)
except
SerializationError
:
return
render_to_response
(
'export.html'
,
context
)
elif
'text/html'
in
requested_format
:
return
render_to_response
(
'export.html'
,
context
)
else
:
# Only HTML
or x-tgz request formats are
supported (no JSON).
# Only HTML
request format is
supported (no JSON).
return
HttpResponse
(
status
=
406
)
...
...
cms/djangoapps/contentstore/views/tests/test_import_export.py
View file @
5cbdd5de
...
...
@@ -559,20 +559,6 @@ class ExportTestCase(CourseTestCase):
resp
=
self
.
client
.
get
(
output_url
)
self
.
_verify_export_succeeded
(
resp
)
def
test_export_targz
(
self
):
"""
Get tar.gz file, using HTTP_ACCEPT.
"""
resp
=
self
.
client
.
get
(
self
.
url
,
HTTP_ACCEPT
=
'application/x-tgz'
)
self
.
_verify_export_succeeded
(
resp
)
def
test_export_targz_urlparam
(
self
):
"""
Get tar.gz file, using URL parameter.
"""
resp
=
self
.
client
.
get
(
self
.
url
+
'?_accept=application/x-tgz'
)
self
.
_verify_export_succeeded
(
resp
)
def
_verify_export_succeeded
(
self
,
resp
):
""" Export success helper method. """
self
.
assertEquals
(
resp
.
status_code
,
200
)
...
...
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