GitHub PullRequestReviewCommentEvent at 2014-08-20 15:45:45
Repository: edx-val
Actor: ormsbee
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-val/pulls/comments/16484437","id":16484437,"diff_hunk":"@@ -44,7 +45,83 @@ class ValVideoNotFoundError(ValError):\n     pass\n \n \n-def get_video_info(edx_video_id, location=None): # pylint: disable=W0613\n+class ValCannotCreateError(ValError):\n+    \"\"\"\n+    This error is raised when an object cannot be created\n+    \"\"\"\n+    pass\n+\n+\n+def create_video(video_data):\n+    \"\"\"\n+    Used to create Video objects in the database\n+\n+    create_video is used to create Video objects whose children are EncodedVideo\n+    objects which are linked to Profile objects. This is an alternative to the HTTP\n+    requests so it can be used internally. The VideoSerializer is used to\n+    deserialize this object. If there are duplicate profile_names, the entire\n+    creation will be rejected. If the profile is not found in the database, the\n+    video will not be created.\n+\n+    Args:\n+        data (dict):\n+         {\n+                url: api url to the video\n+                edx_video_id: ID of the video\n+                duration: Length of video in seconds\n+                client_video_id: client ID of video\n+                encoded_video: a list of EncodedVideo dicts\n+                    url: url of the video\n+                    file_size: size of the video in bytes\n+                    profile: name of the profile\n+                    }\n+                }\n+        }\n+\n+    Returns:\n+        new_object.id (int): id of the newly created object\n+\n+    Raises:\n+        ValCannotCreateError: Raised if the serializer throws an error\n+    \"\"\"\n+    serializer = VideoSerializer(data=video_data)\n+    if serializer.is_valid():\n+        new_object = serializer.save()\n+        return new_object.id\n+    else:\n+        raise ValCannotCreateError(serializer.errors)\n+\n+\n+def create_profile(profile_data):\n+    \"\"\"\n+    Used to create Profile objects in the database\n+\n+    A profile needs to exists before an EncodedVideo object can be created.\n+\n+    Args:\n+        data (dict):\n+        {\n+            profile_name: ID of the profile\n+            extension: 3 letter extension of video\n+            width: horizontal pixel resolution\n+            height: vertical pixel resolution\n+        }\n+\n+    Returns:\n+        new_object.id (int): id of the newly created object\n+\n+    Raises:\n+        ValCannotCreateError: Raised if the serializer throws an error\n+    \"\"\"\n+    serializer = ProfileSerializer(data=profile_data)\n+    if serializer.is_valid():\n+        new_object = serializer.save()\n+        return new_object.id\n+    else:\n+        raise ValCannotCreateError(serializer.errors)","path":"edxval/api.py","position":95,"original_position":95,"commit_id":"67e3386acec7448b5e34ad86c0e3ac848981353a","original_commit_id":"67e3386acec7448b5e34ad86c0e3ac848981353a","user":{"login":"ormsbee","id":41625,"avatar_url":"https://avatars.githubusercontent.com/u/41625?v=2","gravatar_id":"36df5c42f80b1152b764c7ddac7e4d8a","url":"https://api.github.com/users/ormsbee","html_url":"https://github.com/ormsbee","followers_url":"https://api.github.com/users/ormsbee/followers","following_url":"https://api.github.com/users/ormsbee/following{/other_user}","gists_url":"https://api.github.com/users/ormsbee/gists{/gist_id}","starred_url":"https://api.github.com/users/ormsbee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ormsbee/subscriptions","organizations_url":"https://api.github.com/users/ormsbee/orgs","repos_url":"https://api.github.com/users/ormsbee/repos","events_url":"https://api.github.com/users/ormsbee/events{/privacy}","received_events_url":"https://api.github.com/users/ormsbee/received_events","type":"User","site_admin":false},"body":"Again, since externally we're always referencing profiles by name and the names are unique, please return that.","created_at":"2014-08-20T15:45:45Z","updated_at":"2014-08-20T15:45:45Z","html_url":"https://github.com/edx/edx-val/pull/13#discussion_r16484437","pull_request_url":"https://api.github.com/repos/edx/edx-val/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-val/pulls/comments/16484437"},"html":{"href":"https://github.com/edx/edx-val/pull/13#discussion_r16484437"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-val/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-val/pulls/13","id":19938452,"html_url":"https://github.com/edx/edx-val/pull/13","diff_url":"https://github.com/edx/edx-val/pull/13.diff","patch_url":"https://github.com/edx/edx-val/pull/13.patch","issue_url":"https://api.github.com/repos/edx/edx-val/issues/13","number":13,"state":"open","locked":false,"title":"added create_video/profile to api.py for populating database","user":{"login":"BenjiLee","id":7101723,"avatar_url":"https://avatars.githubusercontent.com/u/7101723?v=2","gravatar_id":"e08b1a3658c9dbe0135f03d0876ad3f7","url":"https://api.github.com/users/BenjiLee","html_url":"https://github.com/BenjiLee","followers_url":"https://api.github.com/users/BenjiLee/followers","following_url":"https://api.github.com/users/BenjiLee/following{/other_user}","gists_url":"https://api.github.com/users/BenjiLee/gists{/gist_id}","starred_url":"https://api.github.com/users/BenjiLee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenjiLee/subscriptions","organizations_url":"https://api.github.com/users/BenjiLee/orgs","repos_url":"https://api.github.com/users/BenjiLee/repos","events_url":"https://api.github.com/users/BenjiLee/events{/privacy}","received_events_url":"https://api.github.com/users/BenjiLee/received_events","type":"User","site_admin":false},"body":"@ormsbee @wedaly ","created_at":"2014-08-18T19:18:02Z","updated_at":"2014-08-20T15:45:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cd36f5e2e4dc2d8a9ca714a65efdee6437a1862e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-val/pulls/13/commits","review_comments_url":"https://api.github.com/repos/edx/edx-val/pulls/13/comments","review_comment_url":"https://api.github.com/repos/edx/edx-val/pulls/comments/{number}","comments_url":"https://api.github.com/repos/edx/edx-val/issues/13/comments","statuses_url":"https://api.github.com/repos/edx/edx-val/statuses/67e3386acec7448b5e34ad86c0e3ac848981353a","head":{"label":"edx:clee/populatedb","ref":"clee/populatedb","sha":"67e3386acec7448b5e34ad86c0e3ac848981353a","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=2","gravatar_id":"e1f6c6dc8772c47c0261cd5df2ed2814","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":21628067,"name":"edx-val","full_name":"edx/edx-val","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=2","gravatar_id":"e1f6c6dc8772c47c0261cd5df2ed2814","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-val","description":"","fork":false,"url":"https://api.github.com/repos/edx/edx-val","forks_url":"https://api.github.com/repos/edx/edx-val/forks","keys_url":"https://api.github.com/repos/edx/edx-val/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-val/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-val/teams","hooks_url":"https://api.github.com/repos/edx/edx-val/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-val/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-val/events","assignees_url":"https://api.github.com/repos/edx/edx-val/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-val/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-val/tags","blobs_url":"https://api.github.com/repos/edx/edx-val/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-val/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-val/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-val/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-val/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-val/languages","stargazers_url":"https://api.github.com/repos/edx/edx-val/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-val/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-val/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-val/subscription","commits_url":"https://api.github.com/repos/edx/edx-val/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-val/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-val/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-val/issues/comments/{number}","contents_url":"https://api.github.com/repos/edx/edx-val/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-val/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-val/merges","archive_url":"https://api.github.com/repos/edx/edx-val/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-val/downloads","issues_url":"https://api.github.com/repos/edx/edx-val/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-val/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-val/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-val/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-val/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-val/releases{/id}","created_at":"2014-07-08T20:11:27Z","updated_at":"2014-07-23T21:00:41Z","pushed_at":"2014-08-18T19:41:33Z","git_url":"git://github.com/edx/edx-val.git","ssh_url":"git@github.com:edx/edx-val.git","clone_url":"https://github.com/edx/edx-val.git","svn_url":"https://github.com/edx/edx-val","homepage":null,"size":1544,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"d22f37b549dc1b3c601c61ad3a699f4384695067","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=2","gravatar_id":"e1f6c6dc8772c47c0261cd5df2ed2814","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":21628067,"name":"edx-val","full_name":"edx/edx-val","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=2","gravatar_id":"e1f6c6dc8772c47c0261cd5df2ed2814","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-val","description":"","fork":false,"url":"https://api.github.com/repos/edx/edx-val","forks_url":"https://api.github.com/repos/edx/edx-val/forks","keys_url":"https://api.github.com/repos/edx/edx-val/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-val/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-val/teams","hooks_url":"https://api.github.com/repos/edx/edx-val/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-val/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-val/events","assignees_url":"https://api.github.com/repos/edx/edx-val/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-val/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-val/tags","blobs_url":"https://api.github.com/repos/edx/edx-val/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-val/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-val/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-val/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-val/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-val/languages","stargazers_url":"https://api.github.com/repos/edx/edx-val/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-val/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-val/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-val/subscription","commits_url":"https://api.github.com/repos/edx/edx-val/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-val/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-val/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-val/issues/comments/{number}","contents_url":"https://api.github.com/repos/edx/edx-val/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-val/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-val/merges","archive_url":"https://api.github.com/repos/edx/edx-val/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-val/downloads","issues_url":"https://api.github.com/repos/edx/edx-val/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-val/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-val/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-val/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-val/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-val/releases{/id}","created_at":"2014-07-08T20:11:27Z","updated_at":"2014-07-23T21:00:41Z","pushed_at":"2014-08-18T19:41:33Z","git_url":"git://github.com/edx/edx-val.git","ssh_url":"git@github.com:edx/edx-val.git","clone_url":"https://github.com/edx/edx-val.git","svn_url":"https://github.com/edx/edx-val","homepage":null,"size":1544,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-val/pulls/13"},"html":{"href":"https://github.com/edx/edx-val/pull/13"},"issue":{"href":"https://api.github.com/repos/edx/edx-val/issues/13"},"comments":{"href":"https://api.github.com/repos/edx/edx-val/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-val/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-val/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-val/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-val/statuses/67e3386acec7448b5e34ad86c0e3ac848981353a"}}}}