GitHub PullRequestReviewCommentEvent at 2014-10-22 18:46:31
Repository: edx-platform
Actor: dmitchell
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/19235439","id":19235439,"diff_hunk":"@@ -1436,6 +1442,374 @@ def _create_new_field_data(self, _category, _location, definition_data, metadata\n         field_data = KvsFieldData(kvs)\n         return field_data\n \n+    def _find_course_assets(self, course_key):\n+        \"\"\"\n+        Internal; finds (or creates) course asset info about all assets for a particular course\n+\n+        Arguments:\n+            course_key (CourseKey): course identifier\n+\n+        Returns:\n+            Asset info for the course\n+        \"\"\"\n+        # Using the course_key, find or insert the course asset metadata document.\n+        # A single document exists per course to store the course asset metadata.\n+        course_assets = self.asset_collection.find_one(\n+            {'course_id': unicode(course_key)},\n+            fields={'_id': True, 'assets': True, 'thumbnails': True}\n+            )\n+\n+        if course_assets is None:\n+            # Not found, so create.\n+            course_assets = {'course_id': unicode(course_key), 'storage': 'TODO', 'assets': [], 'thumbnails': []}\n+            asset_id = self.asset_collection.insert(course_assets)\n+\n+        return course_assets\n+\n+    def _find_course_asset(self, course_key, filename, get_thumbnail=False):\n+        \"\"\"\n+        Internal; finds or creates course asset info -and- finds existing asset (or thumbnail) metadata.\n+\n+        Arguments:\n+            course_key (CourseKey): course identifier\n+            filename (str): filename of the asset or thumbnail\n+            get_thumbnail (bool): True gets thumbnail data, False gets asset data\n+\n+        Returns:\n+            Asset info for the course, index of asset/thumbnail in list (None if asset/thumbnail does not exist)\n+        \"\"\"\n+        course_assets = self._find_course_assets(course_key)\n+\n+        if get_thumbnail:\n+            all_assets = course_assets['thumbnails']\n+        else:\n+            all_assets = course_assets['assets']\n+\n+        # See if this asset already exists by checking the external_filename.\n+        # Studio doesn't currently support using multiple course assets with the same filename.\n+        # So use the filename as the unique identifier.\n+        asset_idx = None\n+        for idx, a in enumerate(all_assets):","path":"common/lib/xmodule/xmodule/modulestore/mongo/base.py","position":108,"original_position":84,"commit_id":"a56c897a8f0e82c6bea90777dd25b5bd28ca0a5a","original_commit_id":"1f6956ff204daac2b8bb4759a5f3eb885b57ac99","user":{"login":"dmitchell","id":475919,"avatar_url":"https://avatars.githubusercontent.com/u/475919?v=2","gravatar_id":"","url":"https://api.github.com/users/dmitchell","html_url":"https://github.com/dmitchell","followers_url":"https://api.github.com/users/dmitchell/followers","following_url":"https://api.github.com/users/dmitchell/following{/other_user}","gists_url":"https://api.github.com/users/dmitchell/gists{/gist_id}","starred_url":"https://api.github.com/users/dmitchell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmitchell/subscriptions","organizations_url":"https://api.github.com/users/dmitchell/orgs","repos_url":"https://api.github.com/users/dmitchell/repos","events_url":"https://api.github.com/users/dmitchell/events{/privacy}","received_events_url":"https://api.github.com/users/dmitchell/received_events","type":"User","site_admin":false},"body":"Right. I was merely advocating to have `_save` insert in ordre and just keep the list as ordered on disk and thus in memory.","created_at":"2014-10-22T18:46:31Z","updated_at":"2014-10-22T18:46:31Z","html_url":"https://github.com/edx/edx-platform/pull/4854#discussion_r19235439","pull_request_url":"https://api.github.com/repos/edx/edx-platform/pulls/4854","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/19235439"},"html":{"href":"https://github.com/edx/edx-platform/pull/4854#discussion_r19235439"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/4854"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/4854","id":19851023,"html_url":"https://github.com/edx/edx-platform/pull/4854","diff_url":"https://github.com/edx/edx-platform/pull/4854.diff","patch_url":"https://github.com/edx/edx-platform/pull/4854.patch","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/4854","number":4854,"state":"open","locked":false,"title":"Phase 1 of adding asset metadata saving to old Mongo","user":{"login":"doctoryes","id":7285237,"avatar_url":"https://avatars.githubusercontent.com/u/7285237?v=2","gravatar_id":"","url":"https://api.github.com/users/doctoryes","html_url":"https://github.com/doctoryes","followers_url":"https://api.github.com/users/doctoryes/followers","following_url":"https://api.github.com/users/doctoryes/following{/other_user}","gists_url":"https://api.github.com/users/doctoryes/gists{/gist_id}","starred_url":"https://api.github.com/users/doctoryes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doctoryes/subscriptions","organizations_url":"https://api.github.com/users/doctoryes/orgs","repos_url":"https://api.github.com/users/doctoryes/repos","events_url":"https://api.github.com/users/doctoryes/events{/privacy}","received_events_url":"https://api.github.com/users/doctoryes/received_events","type":"User","site_admin":false},"body":"@dmitchell @cpennington Here's the first phase of my work. Look at the tests to see what is implemented and what isn't yet.","created_at":"2014-08-15T15:48:57Z","updated_at":"2014-10-22T18:46:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b393498893d601148ee9b91756ce6b0f8847eb1b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-platform/pulls/4854/commits","review_comments_url":"https://api.github.com/repos/edx/edx-platform/pulls/4854/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/4854/comments","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/a56c897a8f0e82c6bea90777dd25b5bd28ca0a5a","head":{"label":"edx:jeskew/assetstore_modulestore_work","ref":"jeskew/assetstore_modulestore_work","sha":"a56c897a8f0e82c6bea90777dd25b5bd28ca0a5a","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=2","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=2","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":"2014-10-22T11:15:01Z","pushed_at":"2014-10-22T18:44: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":1646122,"stargazers_count":1481,"watchers_count":1481,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":849,"mirror_url":null,"open_issues_count":95,"forks":849,"open_issues":95,"watchers":1481,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"6baae890c0877791151f24f55ce67a6665242e7f","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=2","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=2","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":"2014-10-22T11:15:01Z","pushed_at":"2014-10-22T18:44: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":1646122,"stargazers_count":1481,"watchers_count":1481,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":849,"mirror_url":null,"open_issues_count":95,"forks":849,"open_issues":95,"watchers":1481,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/4854"},"html":{"href":"https://github.com/edx/edx-platform/pull/4854"},"issue":{"href":"https://api.github.com/repos/edx/edx-platform/issues/4854"},"comments":{"href":"https://api.github.com/repos/edx/edx-platform/issues/4854/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/4854/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/4854/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-platform/statuses/a56c897a8f0e82c6bea90777dd25b5bd28ca0a5a"}}}}