From 5cbdd5de6176bd548755cf55b961e71f75ddc7aa Mon Sep 17 00:00:00 2001 From: Jeremy Bowman Date: Wed, 28 Jun 2017 13:04:49 -0400 Subject: [PATCH] PLAT-1323 Remove older, slower code path for course export --- .../contentstore/views/import_export.py | 21 +++---------------- .../views/tests/test_import_export.py | 14 ------------- 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/cms/djangoapps/contentstore/views/import_export.py b/cms/djangoapps/contentstore/views/import_export.py index b5cd0f4552..74a077169b 100644 --- a/cms/djangoapps/contentstore/views/import_export.py +++ b/cms/djangoapps/contentstore/views/import_export.py @@ -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) diff --git a/cms/djangoapps/contentstore/views/tests/test_import_export.py b/cms/djangoapps/contentstore/views/tests/test_import_export.py index 4ee34a1d0c..28eb68a7e9 100644 --- a/cms/djangoapps/contentstore/views/tests/test_import_export.py +++ b/cms/djangoapps/contentstore/views/tests/test_import_export.py @@ -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)