{"action":"created","comment":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/comments/39324809","id":39324809,"diff_hunk":"@@ -61,15 +62,79 @@ def wrapper(cls):\n     return wrapper\n \n \n-def get_or_http_error(Model, pk, allow_deleted=False):\n-    instance = Model.load(pk)\n+def get_or_http_error(Model, pk_or_query, allow_deleted=False, display_name=None):\n+    \"\"\"Load an instance of Model by primary key or modularodm.Q query. Raise an appropriate\n+    HTTPError if no record is found or if the query fails to find a unique record\n+    :param type Model: StoredObject subclass to query\n+    :param pk_or_query:\n+    :type pk_or_query: either\n+      - a <basestring> representation of the record's primary key, e.g. 'abcdef'\n+      - a <QueryBase> subclass query to uniquely select a record, e.g.\n+        Q('title', 'eq', 'Entitled') & Q('version', 'eq', 1)\n+    :param boolean allow_deleted: allow deleted records\n+    :param basestring display_name:\n+    :return: Model instance\n+    \"\"\"\n+    display_name = display_name or ''\n+\n+    instance = None","path":"framework/mongo/utils.py","position":35,"original_position":35,"commit_id":"0fa235d698d0e8f44a9ad116a4444e40792e11d9","original_commit_id":"0fa235d698d0e8f44a9ad116a4444e40792e11d9","user":{"login":"abought","id":2957073,"avatar_url":"https://avatars.githubusercontent.com/u/2957073?v=3","gravatar_id":"","url":"https://api.github.com/users/abought","html_url":"https://github.com/abought","followers_url":"https://api.github.com/users/abought/followers","following_url":"https://api.github.com/users/abought/following{/other_user}","gists_url":"https://api.github.com/users/abought/gists{/gist_id}","starred_url":"https://api.github.com/users/abought/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abought/subscriptions","organizations_url":"https://api.github.com/users/abought/orgs","repos_url":"https://api.github.com/users/abought/repos","events_url":"https://api.github.com/users/abought/events{/privacy}","received_events_url":"https://api.github.com/users/abought/received_events","type":"User","site_admin":false},"body":"This line can be removed (`instance` is redefined in every branch of the function)","created_at":"2015-09-11T22:29:06Z","updated_at":"2015-09-11T22:29:06Z","html_url":"https://github.com/CenterForOpenScience/osf.io/pull/4280#discussion_r39324809","pull_request_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/4280","_links":{"self":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/comments/39324809"},"html":{"href":"https://github.com/CenterForOpenScience/osf.io/pull/4280#discussion_r39324809"},"pull_request":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/4280"}}},"pull_request":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/4280","id":44827210,"html_url":"https://github.com/CenterForOpenScience/osf.io/pull/4280","diff_url":"https://github.com/CenterForOpenScience/osf.io/pull/4280.diff","patch_url":"https://github.com/CenterForOpenScience/osf.io/pull/4280.patch","issue_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/4280","number":4280,"state":"open","locked":false,"title":"[WIP] Update Pre-registration form to prepare for launch","user":{"login":"barbour-em","id":8905795,"avatar_url":"https://avatars.githubusercontent.com/u/8905795?v=3","gravatar_id":"","url":"https://api.github.com/users/barbour-em","html_url":"https://github.com/barbour-em","followers_url":"https://api.github.com/users/barbour-em/followers","following_url":"https://api.github.com/users/barbour-em/following{/other_user}","gists_url":"https://api.github.com/users/barbour-em/gists{/gist_id}","starred_url":"https://api.github.com/users/barbour-em/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barbour-em/subscriptions","organizations_url":"https://api.github.com/users/barbour-em/orgs","repos_url":"https://api.github.com/users/barbour-em/repos","events_url":"https://api.github.com/users/barbour-em/events{/privacy}","received_events_url":"https://api.github.com/users/barbour-em/received_events","type":"User","site_admin":false},"body":"# Purpose:\r\n* Bring @samchrisinger's `/feature/prereg-prize-2` up to date with develop\r\n* Address [OSF-4327] \r\n\r\n# Changes\r\n\r\n- [X] [OSF-4328]\r\n  - Attaching files to Pre-Registration questions\r\n- [X] [OSF-4348]\r\n  - Update section and question order of pre-registration form\r\n\r\n# Side Effects\r\nTODO","created_at":"2015-09-11T20:46:50Z","updated_at":"2015-09-11T22:29:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c0b5aca298d9f9d6a17670b0774d3c23eb7d6e77","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/4280/commits","review_comments_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/4280/comments","review_comment_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/4280/comments","statuses_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/statuses/0fa235d698d0e8f44a9ad116a4444e40792e11d9","head":{"label":"barbour-em:feature/update-prereg-prize","ref":"feature/update-prereg-prize","sha":"0fa235d698d0e8f44a9ad116a4444e40792e11d9","user":{"login":"barbour-em","id":8905795,"avatar_url":"https://avatars.githubusercontent.com/u/8905795?v=3","gravatar_id":"","url":"https://api.github.com/users/barbour-em","html_url":"https://github.com/barbour-em","followers_url":"https://api.github.com/users/barbour-em/followers","following_url":"https://api.github.com/users/barbour-em/following{/other_user}","gists_url":"https://api.github.com/users/barbour-em/gists{/gist_id}","starred_url":"https://api.github.com/users/barbour-em/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barbour-em/subscriptions","organizations_url":"https://api.github.com/users/barbour-em/orgs","repos_url":"https://api.github.com/users/barbour-em/repos","events_url":"https://api.github.com/users/barbour-em/events{/privacy}","received_events_url":"https://api.github.com/users/barbour-em/received_events","type":"User","site_admin":false},"repo":{"id":36770824,"name":"osf.io","full_name":"barbour-em/osf.io","owner":{"login":"barbour-em","id":8905795,"avatar_url":"https://avatars.githubusercontent.com/u/8905795?v=3","gravatar_id":"","url":"https://api.github.com/users/barbour-em","html_url":"https://github.com/barbour-em","followers_url":"https://api.github.com/users/barbour-em/followers","following_url":"https://api.github.com/users/barbour-em/following{/other_user}","gists_url":"https://api.github.com/users/barbour-em/gists{/gist_id}","starred_url":"https://api.github.com/users/barbour-em/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barbour-em/subscriptions","organizations_url":"https://api.github.com/users/barbour-em/orgs","repos_url":"https://api.github.com/users/barbour-em/repos","events_url":"https://api.github.com/users/barbour-em/events{/privacy}","received_events_url":"https://api.github.com/users/barbour-em/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/barbour-em/osf.io","description":"Facilitating Open Science","fork":true,"url":"https://api.github.com/repos/barbour-em/osf.io","forks_url":"https://api.github.com/repos/barbour-em/osf.io/forks","keys_url":"https://api.github.com/repos/barbour-em/osf.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/barbour-em/osf.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/barbour-em/osf.io/teams","hooks_url":"https://api.github.com/repos/barbour-em/osf.io/hooks","issue_events_url":"https://api.github.com/repos/barbour-em/osf.io/issues/events{/number}","events_url":"https://api.github.com/repos/barbour-em/osf.io/events","assignees_url":"https://api.github.com/repos/barbour-em/osf.io/assignees{/user}","branches_url":"https://api.github.com/repos/barbour-em/osf.io/branches{/branch}","tags_url":"https://api.github.com/repos/barbour-em/osf.io/tags","blobs_url":"https://api.github.com/repos/barbour-em/osf.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/barbour-em/osf.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/barbour-em/osf.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/barbour-em/osf.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/barbour-em/osf.io/statuses/{sha}","languages_url":"https://api.github.com/repos/barbour-em/osf.io/languages","stargazers_url":"https://api.github.com/repos/barbour-em/osf.io/stargazers","contributors_url":"https://api.github.com/repos/barbour-em/osf.io/contributors","subscribers_url":"https://api.github.com/repos/barbour-em/osf.io/subscribers","subscription_url":"https://api.github.com/repos/barbour-em/osf.io/subscription","commits_url":"https://api.github.com/repos/barbour-em/osf.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/barbour-em/osf.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/barbour-em/osf.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/barbour-em/osf.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/barbour-em/osf.io/contents/{+path}","compare_url":"https://api.github.com/repos/barbour-em/osf.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/barbour-em/osf.io/merges","archive_url":"https://api.github.com/repos/barbour-em/osf.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/barbour-em/osf.io/downloads","issues_url":"https://api.github.com/repos/barbour-em/osf.io/issues{/number}","pulls_url":"https://api.github.com/repos/barbour-em/osf.io/pulls{/number}","milestones_url":"https://api.github.com/repos/barbour-em/osf.io/milestones{/number}","notifications_url":"https://api.github.com/repos/barbour-em/osf.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/barbour-em/osf.io/labels{/name}","releases_url":"https://api.github.com/repos/barbour-em/osf.io/releases{/id}","created_at":"2015-06-03T00:55:54Z","updated_at":"2015-06-03T00:55:58Z","pushed_at":"2015-09-11T20:33:41Z","git_url":"git://github.com/barbour-em/osf.io.git","ssh_url":"git@github.com:barbour-em/osf.io.git","clone_url":"https://github.com/barbour-em/osf.io.git","svn_url":"https://github.com/barbour-em/osf.io","homepage":"http://osf.io","size":99682,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"CenterForOpenScience:develop","ref":"develop","sha":"198c7fed890713896b6a996f60ed5a10a1d47579","user":{"login":"CenterForOpenScience","id":3344584,"avatar_url":"https://avatars.githubusercontent.com/u/3344584?v=3","gravatar_id":"","url":"https://api.github.com/users/CenterForOpenScience","html_url":"https://github.com/CenterForOpenScience","followers_url":"https://api.github.com/users/CenterForOpenScience/followers","following_url":"https://api.github.com/users/CenterForOpenScience/following{/other_user}","gists_url":"https://api.github.com/users/CenterForOpenScience/gists{/gist_id}","starred_url":"https://api.github.com/users/CenterForOpenScience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CenterForOpenScience/subscriptions","organizations_url":"https://api.github.com/users/CenterForOpenScience/orgs","repos_url":"https://api.github.com/users/CenterForOpenScience/repos","events_url":"https://api.github.com/users/CenterForOpenScience/events{/privacy}","received_events_url":"https://api.github.com/users/CenterForOpenScience/received_events","type":"Organization","site_admin":false},"repo":{"id":10199599,"name":"osf.io","full_name":"CenterForOpenScience/osf.io","owner":{"login":"CenterForOpenScience","id":3344584,"avatar_url":"https://avatars.githubusercontent.com/u/3344584?v=3","gravatar_id":"","url":"https://api.github.com/users/CenterForOpenScience","html_url":"https://github.com/CenterForOpenScience","followers_url":"https://api.github.com/users/CenterForOpenScience/followers","following_url":"https://api.github.com/users/CenterForOpenScience/following{/other_user}","gists_url":"https://api.github.com/users/CenterForOpenScience/gists{/gist_id}","starred_url":"https://api.github.com/users/CenterForOpenScience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CenterForOpenScience/subscriptions","organizations_url":"https://api.github.com/users/CenterForOpenScience/orgs","repos_url":"https://api.github.com/users/CenterForOpenScience/repos","events_url":"https://api.github.com/users/CenterForOpenScience/events{/privacy}","received_events_url":"https://api.github.com/users/CenterForOpenScience/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CenterForOpenScience/osf.io","description":"Facilitating Open Science","fork":false,"url":"https://api.github.com/repos/CenterForOpenScience/osf.io","forks_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/forks","keys_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/teams","hooks_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/hooks","issue_events_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/events{/number}","events_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/events","assignees_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/assignees{/user}","branches_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/branches{/branch}","tags_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/tags","blobs_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/statuses/{sha}","languages_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/languages","stargazers_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/stargazers","contributors_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/contributors","subscribers_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/subscribers","subscription_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/subscription","commits_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/contents/{+path}","compare_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/merges","archive_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/downloads","issues_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues{/number}","pulls_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls{/number}","milestones_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/milestones{/number}","notifications_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/labels{/name}","releases_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/releases{/id}","created_at":"2013-05-21T15:53:37Z","updated_at":"2015-09-10T13:17:29Z","pushed_at":"2015-09-11T20:58:56Z","git_url":"git://github.com/CenterForOpenScience/osf.io.git","ssh_url":"git@github.com:CenterForOpenScience/osf.io.git","clone_url":"https://github.com/CenterForOpenScience/osf.io.git","svn_url":"https://github.com/CenterForOpenScience/osf.io","homepage":"http://osf.io","size":229176,"stargazers_count":137,"watchers_count":137,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":115,"mirror_url":null,"open_issues_count":418,"forks":115,"open_issues":418,"watchers":137,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/4280"},"html":{"href":"https://github.com/CenterForOpenScience/osf.io/pull/4280"},"issue":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/4280"},"comments":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/4280/comments"},"review_comments":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/4280/comments"},"review_comment":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/4280/commits"},"statuses":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/statuses/0fa235d698d0e8f44a9ad116a4444e40792e11d9"}}}}