{"action":"created","comment":{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/comments/25442947","id":25442947,"diff_hunk":"@@ -71,7 +71,11 @@ def get_attribute(instance, attrs):\n         except ObjectDoesNotExist:\n             return None\n         if is_simple_callable(instance):\n-            instance = instance()\n+            try:\n+                instance = instance()\n+            except (AttributeError, KeyError) as exc:\n+                raise CallableAttributeExceptionWrapper(exc)","path":"rest_framework/fields.py","position":8,"original_position":8,"commit_id":"206cff2e504f688f291a60e7738f08d5bbfbc393","original_commit_id":"206cff2e504f688f291a60e7738f08d5bbfbc393","user":{"login":"tomchristie","id":647359,"avatar_url":"https://avatars.githubusercontent.com/u/647359?v=3","gravatar_id":"","url":"https://api.github.com/users/tomchristie","html_url":"https://github.com/tomchristie","followers_url":"https://api.github.com/users/tomchristie/followers","following_url":"https://api.github.com/users/tomchristie/following{/other_user}","gists_url":"https://api.github.com/users/tomchristie/gists{/gist_id}","starred_url":"https://api.github.com/users/tomchristie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomchristie/subscriptions","organizations_url":"https://api.github.com/users/tomchristie/orgs","repos_url":"https://api.github.com/users/tomchristie/repos","events_url":"https://api.github.com/users/tomchristie/events{/privacy}","received_events_url":"https://api.github.com/users/tomchristie/received_events","type":"User","site_admin":false},"body":"Rather than wrap these in a special exception type that's handled explicitly it might be simpler to just wrap them in, say, `ValueError`, with a descriptive message along the lines \"Invalid value for 'default' argument. An exception was raised. Original message was: ...\".\r\n\r\nLet's then just keep that super simple and not bother catching it elsewhere - at least we're giving better visibility to the developer then without adding complexity to the `Field.get_attribute()` method.","created_at":"2015-02-26T16:52:14Z","updated_at":"2015-02-26T16:52:14Z","html_url":"https://github.com/tomchristie/django-rest-framework/pull/2608#discussion_r25442947","pull_request_url":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/2608","_links":{"self":{"href":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/comments/25442947"},"html":{"href":"https://github.com/tomchristie/django-rest-framework/pull/2608#discussion_r25442947"},"pull_request":{"href":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/2608"}}},"pull_request":{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/2608","id":30093928,"html_url":"https://github.com/tomchristie/django-rest-framework/pull/2608","diff_url":"https://github.com/tomchristie/django-rest-framework/pull/2608.diff","patch_url":"https://github.com/tomchristie/django-rest-framework/pull/2608.patch","issue_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2608","number":2608,"state":"open","locked":false,"title":"Dont swallow errors in callable sources","user":{"login":"ezheidtmann","id":1178915,"avatar_url":"https://avatars.githubusercontent.com/u/1178915?v=3","gravatar_id":"","url":"https://api.github.com/users/ezheidtmann","html_url":"https://github.com/ezheidtmann","followers_url":"https://api.github.com/users/ezheidtmann/followers","following_url":"https://api.github.com/users/ezheidtmann/following{/other_user}","gists_url":"https://api.github.com/users/ezheidtmann/gists{/gist_id}","starred_url":"https://api.github.com/users/ezheidtmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezheidtmann/subscriptions","organizations_url":"https://api.github.com/users/ezheidtmann/orgs","repos_url":"https://api.github.com/users/ezheidtmann/repos","events_url":"https://api.github.com/users/ezheidtmann/events{/privacy}","received_events_url":"https://api.github.com/users/ezheidtmann/received_events","type":"User","site_admin":false},"body":"Hey Tom,\r\n\r\nHere's a possible fix for the original part of #2598. I'm no python expert, so if this is a bad idea please tell me why I'm wrong. Thanks for your time!\r\n\r\nEvan","created_at":"2015-02-26T16:43:51Z","updated_at":"2015-02-26T16:52:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fbe4865ff4f54b700bb637e2010b52b90f35ac40","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/2608/commits","review_comments_url":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/2608/comments","review_comment_url":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2608/comments","statuses_url":"https://api.github.com/repos/tomchristie/django-rest-framework/statuses/206cff2e504f688f291a60e7738f08d5bbfbc393","head":{"label":"ezheidtmann:dont-swallow-errors-in-callable-sources","ref":"dont-swallow-errors-in-callable-sources","sha":"206cff2e504f688f291a60e7738f08d5bbfbc393","user":{"login":"ezheidtmann","id":1178915,"avatar_url":"https://avatars.githubusercontent.com/u/1178915?v=3","gravatar_id":"","url":"https://api.github.com/users/ezheidtmann","html_url":"https://github.com/ezheidtmann","followers_url":"https://api.github.com/users/ezheidtmann/followers","following_url":"https://api.github.com/users/ezheidtmann/following{/other_user}","gists_url":"https://api.github.com/users/ezheidtmann/gists{/gist_id}","starred_url":"https://api.github.com/users/ezheidtmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezheidtmann/subscriptions","organizations_url":"https://api.github.com/users/ezheidtmann/orgs","repos_url":"https://api.github.com/users/ezheidtmann/repos","events_url":"https://api.github.com/users/ezheidtmann/events{/privacy}","received_events_url":"https://api.github.com/users/ezheidtmann/received_events","type":"User","site_admin":false},"repo":{"id":31374924,"name":"django-rest-framework","full_name":"ezheidtmann/django-rest-framework","owner":{"login":"ezheidtmann","id":1178915,"avatar_url":"https://avatars.githubusercontent.com/u/1178915?v=3","gravatar_id":"","url":"https://api.github.com/users/ezheidtmann","html_url":"https://github.com/ezheidtmann","followers_url":"https://api.github.com/users/ezheidtmann/followers","following_url":"https://api.github.com/users/ezheidtmann/following{/other_user}","gists_url":"https://api.github.com/users/ezheidtmann/gists{/gist_id}","starred_url":"https://api.github.com/users/ezheidtmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezheidtmann/subscriptions","organizations_url":"https://api.github.com/users/ezheidtmann/orgs","repos_url":"https://api.github.com/users/ezheidtmann/repos","events_url":"https://api.github.com/users/ezheidtmann/events{/privacy}","received_events_url":"https://api.github.com/users/ezheidtmann/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ezheidtmann/django-rest-framework","description":"Web APIs for Django.","fork":true,"url":"https://api.github.com/repos/ezheidtmann/django-rest-framework","forks_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/forks","keys_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/teams","hooks_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/hooks","issue_events_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/issues/events{/number}","events_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/events","assignees_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/assignees{/user}","branches_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/branches{/branch}","tags_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/tags","blobs_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/statuses/{sha}","languages_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/languages","stargazers_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/stargazers","contributors_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/contributors","subscribers_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/subscribers","subscription_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/subscription","commits_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/contents/{+path}","compare_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/merges","archive_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/downloads","issues_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/issues{/number}","pulls_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/pulls{/number}","milestones_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/milestones{/number}","notifications_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/labels{/name}","releases_url":"https://api.github.com/repos/ezheidtmann/django-rest-framework/releases{/id}","created_at":"2015-02-26T15:56:30Z","updated_at":"2015-02-26T15:56:32Z","pushed_at":"2015-02-26T16:46:42Z","git_url":"git://github.com/ezheidtmann/django-rest-framework.git","ssh_url":"git@github.com:ezheidtmann/django-rest-framework.git","clone_url":"https://github.com/ezheidtmann/django-rest-framework.git","svn_url":"https://github.com/ezheidtmann/django-rest-framework","homepage":"www.django-rest-framework.org","size":31146,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"tomchristie:master","ref":"master","sha":"c66f23391ac669f2a9a27431e66588e9092300f2","user":{"login":"tomchristie","id":647359,"avatar_url":"https://avatars.githubusercontent.com/u/647359?v=3","gravatar_id":"","url":"https://api.github.com/users/tomchristie","html_url":"https://github.com/tomchristie","followers_url":"https://api.github.com/users/tomchristie/followers","following_url":"https://api.github.com/users/tomchristie/following{/other_user}","gists_url":"https://api.github.com/users/tomchristie/gists{/gist_id}","starred_url":"https://api.github.com/users/tomchristie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomchristie/subscriptions","organizations_url":"https://api.github.com/users/tomchristie/orgs","repos_url":"https://api.github.com/users/tomchristie/repos","events_url":"https://api.github.com/users/tomchristie/events{/privacy}","received_events_url":"https://api.github.com/users/tomchristie/received_events","type":"User","site_admin":false},"repo":{"id":1431547,"name":"django-rest-framework","full_name":"tomchristie/django-rest-framework","owner":{"login":"tomchristie","id":647359,"avatar_url":"https://avatars.githubusercontent.com/u/647359?v=3","gravatar_id":"","url":"https://api.github.com/users/tomchristie","html_url":"https://github.com/tomchristie","followers_url":"https://api.github.com/users/tomchristie/followers","following_url":"https://api.github.com/users/tomchristie/following{/other_user}","gists_url":"https://api.github.com/users/tomchristie/gists{/gist_id}","starred_url":"https://api.github.com/users/tomchristie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomchristie/subscriptions","organizations_url":"https://api.github.com/users/tomchristie/orgs","repos_url":"https://api.github.com/users/tomchristie/repos","events_url":"https://api.github.com/users/tomchristie/events{/privacy}","received_events_url":"https://api.github.com/users/tomchristie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tomchristie/django-rest-framework","description":"Web APIs for Django.","fork":false,"url":"https://api.github.com/repos/tomchristie/django-rest-framework","forks_url":"https://api.github.com/repos/tomchristie/django-rest-framework/forks","keys_url":"https://api.github.com/repos/tomchristie/django-rest-framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tomchristie/django-rest-framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tomchristie/django-rest-framework/teams","hooks_url":"https://api.github.com/repos/tomchristie/django-rest-framework/hooks","issue_events_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/events{/number}","events_url":"https://api.github.com/repos/tomchristie/django-rest-framework/events","assignees_url":"https://api.github.com/repos/tomchristie/django-rest-framework/assignees{/user}","branches_url":"https://api.github.com/repos/tomchristie/django-rest-framework/branches{/branch}","tags_url":"https://api.github.com/repos/tomchristie/django-rest-framework/tags","blobs_url":"https://api.github.com/repos/tomchristie/django-rest-framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tomchristie/django-rest-framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tomchristie/django-rest-framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/tomchristie/django-rest-framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tomchristie/django-rest-framework/statuses/{sha}","languages_url":"https://api.github.com/repos/tomchristie/django-rest-framework/languages","stargazers_url":"https://api.github.com/repos/tomchristie/django-rest-framework/stargazers","contributors_url":"https://api.github.com/repos/tomchristie/django-rest-framework/contributors","subscribers_url":"https://api.github.com/repos/tomchristie/django-rest-framework/subscribers","subscription_url":"https://api.github.com/repos/tomchristie/django-rest-framework/subscription","commits_url":"https://api.github.com/repos/tomchristie/django-rest-framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/tomchristie/django-rest-framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/tomchristie/django-rest-framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/tomchristie/django-rest-framework/contents/{+path}","compare_url":"https://api.github.com/repos/tomchristie/django-rest-framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tomchristie/django-rest-framework/merges","archive_url":"https://api.github.com/repos/tomchristie/django-rest-framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tomchristie/django-rest-framework/downloads","issues_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues{/number}","pulls_url":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls{/number}","milestones_url":"https://api.github.com/repos/tomchristie/django-rest-framework/milestones{/number}","notifications_url":"https://api.github.com/repos/tomchristie/django-rest-framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tomchristie/django-rest-framework/labels{/name}","releases_url":"https://api.github.com/repos/tomchristie/django-rest-framework/releases{/id}","created_at":"2011-03-02T17:13:56Z","updated_at":"2015-02-26T15:56:19Z","pushed_at":"2015-02-26T15:56:19Z","git_url":"git://github.com/tomchristie/django-rest-framework.git","ssh_url":"git@github.com:tomchristie/django-rest-framework.git","clone_url":"https://github.com/tomchristie/django-rest-framework.git","svn_url":"https://github.com/tomchristie/django-rest-framework","homepage":"www.django-rest-framework.org","size":31146,"stargazers_count":3621,"watchers_count":3621,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1101,"mirror_url":null,"open_issues_count":76,"forks":1101,"open_issues":76,"watchers":3621,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/2608"},"html":{"href":"https://github.com/tomchristie/django-rest-framework/pull/2608"},"issue":{"href":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2608"},"comments":{"href":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2608/comments"},"review_comments":{"href":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/2608/comments"},"review_comment":{"href":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/2608/commits"},"statuses":{"href":"https://api.github.com/repos/tomchristie/django-rest-framework/statuses/206cff2e504f688f291a60e7738f08d5bbfbc393"}}}}