{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/26978214","id":26978214,"diff_hunk":"@@ -332,92 +82,60 @@ def import_status_handler(request, course_key_string, filename=None):\n @ensure_valid_course_key\n def export_handler(request, course_key_string):\n     \"\"\"\n-    The restful handler for exporting a course.\n+    The restful handler for the export page.\n \n     GET\n         html: return html page for import page\n-        application/x-tgz: return tar.gz file containing exported course\n-        json: not supported\n+    \"\"\"\n+    error = request.GET.get('error', None)\n+    error_message = request.GET.get('error_message', None)\n+    failed_module = request.GET.get('failed_module', None)\n+    unit = request.GET.get('unit', None)\n+    parent = request.GET.get('parent', None)\n \n-    Note that there are 2 ways to request the tar.gz file. The request header can specify\n-    application/x-tgz via HTTP_ACCEPT, or a query parameter can be used (?_accept=application/x-tgz).\n+    if parent:\n+        try:\n+            parent = CourseKey.from_string(parent)\n+        except InvalidKeyError:\n+            parent = None","path":"cms/djangoapps/contentstore/views/import_export.py","position":386,"original_position":386,"commit_id":"36dd858464ed70b4bc4d31adafbe34bf959680f2","original_commit_id":"36dd858464ed70b4bc4d31adafbe34bf959680f2","user":{"login":"singingwolfboy","id":132355,"avatar_url":"https://avatars.githubusercontent.com/u/132355?v=3","gravatar_id":"","url":"https://api.github.com/users/singingwolfboy","html_url":"https://github.com/singingwolfboy","followers_url":"https://api.github.com/users/singingwolfboy/followers","following_url":"https://api.github.com/users/singingwolfboy/following{/other_user}","gists_url":"https://api.github.com/users/singingwolfboy/gists{/gist_id}","starred_url":"https://api.github.com/users/singingwolfboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/singingwolfboy/subscriptions","organizations_url":"https://api.github.com/users/singingwolfboy/orgs","repos_url":"https://api.github.com/users/singingwolfboy/repos","events_url":"https://api.github.com/users/singingwolfboy/events{/privacy}","received_events_url":"https://api.github.com/users/singingwolfboy/received_events","type":"User","site_admin":false},"body":"I would expect this to trigger some kind of error response here, rather than setting `parent = None` and moving on. If someone hits this endpoint and provides a `parent` parameter, but there is some error in transforming that into a `CourseKey`, then this code will silently drop that parameter and move on -- a very difficult situation to debug! Can you make it display an error in the HTML page if that is the case? (If this was a JSON API, I'd suggest that you immediately return a 400 status code response, but you've changed this to only output HTML.)","created_at":"2015-03-23T20:48:21Z","updated_at":"2015-03-23T20:48:21Z","html_url":"https://github.com/edx/edx-platform/pull/6190#discussion_r26978214","pull_request_url":"https://api.github.com/repos/edx/edx-platform/pulls/6190","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/26978214"},"html":{"href":"https://github.com/edx/edx-platform/pull/6190#discussion_r26978214"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/6190"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/6190","id":25717411,"html_url":"https://github.com/edx/edx-platform/pull/6190","diff_url":"https://github.com/edx/edx-platform/pull/6190.diff","patch_url":"https://github.com/edx/edx-platform/pull/6190.patch","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/6190","number":6190,"state":"open","locked":false,"title":"Public Course Import/Export API","user":{"login":"bdero","id":919017,"avatar_url":"https://avatars.githubusercontent.com/u/919017?v=3","gravatar_id":"","url":"https://api.github.com/users/bdero","html_url":"https://github.com/bdero","followers_url":"https://api.github.com/users/bdero/followers","following_url":"https://api.github.com/users/bdero/following{/other_user}","gists_url":"https://api.github.com/users/bdero/gists{/gist_id}","starred_url":"https://api.github.com/users/bdero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdero/subscriptions","organizations_url":"https://api.github.com/users/bdero/orgs","repos_url":"https://api.github.com/users/bdero/repos","events_url":"https://api.github.com/users/bdero/events{/privacy}","received_events_url":"https://api.github.com/users/bdero/received_events","type":"User","site_admin":false},"body":"This is a public, shared, versioned, RESTful API for importing and exporting full course content. The code was initially ripped from the existing import/export API in the CMS contentstore djangoapp and wrapped in Django Rest Framework view classes. It's simply a new djangoapp in the *openedx* directory with 4 views:\r\n- GET /api/v1/courses - List courses (course keys) for which the user has full author access\r\n- GET /api/v1/courses/{course_key} - Export a full course in the form of a tarball\r\n- POST /api/v1/courses/{course_key} - Import a full course tarball\r\n- GET /api/v1/courses/{course_key}/import_status/{filename} - View the status of a course import (see https://github.com/edx/edx-platform/pull/6190/files#diff-4c6e0b7531e770ee217a370f8d990ac8R108)\r\n\r\nThis PR includes configuration changes. Most notably, Studio is configured to serve the OAuth2 provider alongside the LMS.\r\n\r\nHere's the relevant thread on the code list: https://groups.google.com/forum/#!msg/edx-code/DmnHWmly25A/ZqjD1zb4o7oJ\r\n\r\nThere are 28 non-covered lines, all of which are missing coverage in the existing CMS API. They're mostly error conditions, such as handling of multipart file upload errors.","created_at":"2014-12-09T03:41:43Z","updated_at":"2015-03-23T20:48:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"504c9c8a68c0676ed3c4582e53a1e859793d47cc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-platform/pulls/6190/commits","review_comments_url":"https://api.github.com/repos/edx/edx-platform/pulls/6190/comments","review_comment_url":"https://api.github.com/repos/edx/edx-platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/edx-platform/issues/6190/comments","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/36dd858464ed70b4bc4d31adafbe34bf959680f2","head":{"label":"mitocw:bdero/import-export-api","ref":"bdero/import-export-api","sha":"36dd858464ed70b4bc4d31adafbe34bf959680f2","user":{"login":"mitocw","id":3009146,"avatar_url":"https://avatars.githubusercontent.com/u/3009146?v=3","gravatar_id":"","url":"https://api.github.com/users/mitocw","html_url":"https://github.com/mitocw","followers_url":"https://api.github.com/users/mitocw/followers","following_url":"https://api.github.com/users/mitocw/following{/other_user}","gists_url":"https://api.github.com/users/mitocw/gists{/gist_id}","starred_url":"https://api.github.com/users/mitocw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitocw/subscriptions","organizations_url":"https://api.github.com/users/mitocw/orgs","repos_url":"https://api.github.com/users/mitocw/repos","events_url":"https://api.github.com/users/mitocw/events{/privacy}","received_events_url":"https://api.github.com/users/mitocw/received_events","type":"Organization","site_admin":false},"repo":{"id":17842334,"name":"edx-platform","full_name":"mitocw/edx-platform","owner":{"login":"mitocw","id":3009146,"avatar_url":"https://avatars.githubusercontent.com/u/3009146?v=3","gravatar_id":"","url":"https://api.github.com/users/mitocw","html_url":"https://github.com/mitocw","followers_url":"https://api.github.com/users/mitocw/followers","following_url":"https://api.github.com/users/mitocw/following{/other_user}","gists_url":"https://api.github.com/users/mitocw/gists{/gist_id}","starred_url":"https://api.github.com/users/mitocw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitocw/subscriptions","organizations_url":"https://api.github.com/users/mitocw/orgs","repos_url":"https://api.github.com/users/mitocw/repos","events_url":"https://api.github.com/users/mitocw/events{/privacy}","received_events_url":"https://api.github.com/users/mitocw/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mitocw/edx-platform","description":"the edX learning management system (LMS) and course authoring tool, Studio","fork":true,"url":"https://api.github.com/repos/mitocw/edx-platform","forks_url":"https://api.github.com/repos/mitocw/edx-platform/forks","keys_url":"https://api.github.com/repos/mitocw/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mitocw/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mitocw/edx-platform/teams","hooks_url":"https://api.github.com/repos/mitocw/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/mitocw/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/mitocw/edx-platform/events","assignees_url":"https://api.github.com/repos/mitocw/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/mitocw/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/mitocw/edx-platform/tags","blobs_url":"https://api.github.com/repos/mitocw/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mitocw/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mitocw/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/mitocw/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mitocw/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/mitocw/edx-platform/languages","stargazers_url":"https://api.github.com/repos/mitocw/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/mitocw/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/mitocw/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/mitocw/edx-platform/subscription","commits_url":"https://api.github.com/repos/mitocw/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/mitocw/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/mitocw/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/mitocw/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/mitocw/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/mitocw/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mitocw/edx-platform/merges","archive_url":"https://api.github.com/repos/mitocw/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mitocw/edx-platform/downloads","issues_url":"https://api.github.com/repos/mitocw/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/mitocw/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/mitocw/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/mitocw/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mitocw/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/mitocw/edx-platform/releases{/id}","created_at":"2014-03-17T20:32:05Z","updated_at":"2015-03-20T14:00:47Z","pushed_at":"2015-03-20T14:00:35Z","git_url":"git://github.com/mitocw/edx-platform.git","ssh_url":"git@github.com:mitocw/edx-platform.git","clone_url":"https://github.com/mitocw/edx-platform.git","svn_url":"https://github.com/mitocw/edx-platform","homepage":"http://code.edx.org/","size":444719,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"984f8732f1b44b2c8b6fda076719086b69975206","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":10391073,"name":"edx-platform","full_name":"edx/edx-platform","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-platform","description":"Open edX, the edX platform that powers http://edx.org","fork":false,"url":"https://api.github.com/repos/edx/edx-platform","forks_url":"https://api.github.com/repos/edx/edx-platform/forks","keys_url":"https://api.github.com/repos/edx/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-platform/events","assignees_url":"https://api.github.com/repos/edx/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-platform/merges","archive_url":"https://api.github.com/repos/edx/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-platform/releases{/id}","created_at":"2013-05-30T20:20:38Z","updated_at":"2015-03-23T19:05:09Z","pushed_at":"2015-03-23T20:45:47Z","git_url":"git://github.com/edx/edx-platform.git","ssh_url":"git@github.com:edx/edx-platform.git","clone_url":"https://github.com/edx/edx-platform.git","svn_url":"https://github.com/edx/edx-platform","homepage":"http://openedx.org/","size":1834797,"stargazers_count":1808,"watchers_count":1808,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1029,"mirror_url":null,"open_issues_count":134,"forks":1029,"open_issues":134,"watchers":1808,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/6190"},"html":{"href":"https://github.com/edx/edx-platform/pull/6190"},"issue":{"href":"https://api.github.com/repos/edx/edx-platform/issues/6190"},"comments":{"href":"https://api.github.com/repos/edx/edx-platform/issues/6190/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/6190/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/6190/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-platform/statuses/36dd858464ed70b4bc4d31adafbe34bf959680f2"}}}}