{"action":"created","comment":{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/comments/24481781","id":24481781,"diff_hunk":"@@ -134,12 +134,14 @@ def http_method_not_allowed(self, request, *args, **kwargs):\n         \"\"\"\n         raise exceptions.MethodNotAllowed(request.method)\n \n-    def permission_denied(self, request):\n+    def permission_denied(self, request, message=None):\n         \"\"\"\n         If request is not permitted, determine what kind of exception to raise.\n         \"\"\"\n         if not request.successful_authenticator:\n             raise exceptions.NotAuthenticated()\n+        if message is not None:\n+            raise exceptions.PermissionDenied(message)\n         raise exceptions.PermissionDenied()","path":"rest_framework/views.py","position":13,"original_position":13,"commit_id":"9ea615af14303663a47fd155ab541d8302d609e4","original_commit_id":"9ea615af14303663a47fd155ab541d8302d609e4","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":"Can we just simplify this to `raise exceptions.PermissionDenied(message=message)` - That'll still work fine if message is `None`, right?","created_at":"2015-02-11T09:24:38Z","updated_at":"2015-02-11T09:24:38Z","html_url":"https://github.com/tomchristie/django-rest-framework/pull/2539#discussion_r24481781","pull_request_url":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/2539","_links":{"self":{"href":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/comments/24481781"},"html":{"href":"https://github.com/tomchristie/django-rest-framework/pull/2539#discussion_r24481781"},"pull_request":{"href":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/2539"}}},"pull_request":{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/2539","id":29040793,"html_url":"https://github.com/tomchristie/django-rest-framework/pull/2539","diff_url":"https://github.com/tomchristie/django-rest-framework/pull/2539.diff","patch_url":"https://github.com/tomchristie/django-rest-framework/pull/2539.patch","issue_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2539","number":2539,"state":"open","locked":false,"title":"add message to custom permission","user":{"login":"donewell","id":6536255,"avatar_url":"https://avatars.githubusercontent.com/u/6536255?v=3","gravatar_id":"","url":"https://api.github.com/users/donewell","html_url":"https://github.com/donewell","followers_url":"https://api.github.com/users/donewell/followers","following_url":"https://api.github.com/users/donewell/following{/other_user}","gists_url":"https://api.github.com/users/donewell/gists{/gist_id}","starred_url":"https://api.github.com/users/donewell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donewell/subscriptions","organizations_url":"https://api.github.com/users/donewell/orgs","repos_url":"https://api.github.com/users/donewell/repos","events_url":"https://api.github.com/users/donewell/events{/privacy}","received_events_url":"https://api.github.com/users/donewell/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-02-10T20:17:46Z","updated_at":"2015-02-11T09:24:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d60045fa8cbd0248537e4f20a4dd7e6378647af1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/2539/commits","review_comments_url":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/2539/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/2539/comments","statuses_url":"https://api.github.com/repos/tomchristie/django-rest-framework/statuses/9ea615af14303663a47fd155ab541d8302d609e4","head":{"label":"donewell:permission-detail","ref":"permission-detail","sha":"9ea615af14303663a47fd155ab541d8302d609e4","user":{"login":"donewell","id":6536255,"avatar_url":"https://avatars.githubusercontent.com/u/6536255?v=3","gravatar_id":"","url":"https://api.github.com/users/donewell","html_url":"https://github.com/donewell","followers_url":"https://api.github.com/users/donewell/followers","following_url":"https://api.github.com/users/donewell/following{/other_user}","gists_url":"https://api.github.com/users/donewell/gists{/gist_id}","starred_url":"https://api.github.com/users/donewell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donewell/subscriptions","organizations_url":"https://api.github.com/users/donewell/orgs","repos_url":"https://api.github.com/users/donewell/repos","events_url":"https://api.github.com/users/donewell/events{/privacy}","received_events_url":"https://api.github.com/users/donewell/received_events","type":"User","site_admin":false},"repo":{"id":30603788,"name":"django-rest-framework","full_name":"donewell/django-rest-framework","owner":{"login":"donewell","id":6536255,"avatar_url":"https://avatars.githubusercontent.com/u/6536255?v=3","gravatar_id":"","url":"https://api.github.com/users/donewell","html_url":"https://github.com/donewell","followers_url":"https://api.github.com/users/donewell/followers","following_url":"https://api.github.com/users/donewell/following{/other_user}","gists_url":"https://api.github.com/users/donewell/gists{/gist_id}","starred_url":"https://api.github.com/users/donewell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donewell/subscriptions","organizations_url":"https://api.github.com/users/donewell/orgs","repos_url":"https://api.github.com/users/donewell/repos","events_url":"https://api.github.com/users/donewell/events{/privacy}","received_events_url":"https://api.github.com/users/donewell/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/donewell/django-rest-framework","description":"Web APIs for Django.","fork":true,"url":"https://api.github.com/repos/donewell/django-rest-framework","forks_url":"https://api.github.com/repos/donewell/django-rest-framework/forks","keys_url":"https://api.github.com/repos/donewell/django-rest-framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/donewell/django-rest-framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/donewell/django-rest-framework/teams","hooks_url":"https://api.github.com/repos/donewell/django-rest-framework/hooks","issue_events_url":"https://api.github.com/repos/donewell/django-rest-framework/issues/events{/number}","events_url":"https://api.github.com/repos/donewell/django-rest-framework/events","assignees_url":"https://api.github.com/repos/donewell/django-rest-framework/assignees{/user}","branches_url":"https://api.github.com/repos/donewell/django-rest-framework/branches{/branch}","tags_url":"https://api.github.com/repos/donewell/django-rest-framework/tags","blobs_url":"https://api.github.com/repos/donewell/django-rest-framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/donewell/django-rest-framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/donewell/django-rest-framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/donewell/django-rest-framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/donewell/django-rest-framework/statuses/{sha}","languages_url":"https://api.github.com/repos/donewell/django-rest-framework/languages","stargazers_url":"https://api.github.com/repos/donewell/django-rest-framework/stargazers","contributors_url":"https://api.github.com/repos/donewell/django-rest-framework/contributors","subscribers_url":"https://api.github.com/repos/donewell/django-rest-framework/subscribers","subscription_url":"https://api.github.com/repos/donewell/django-rest-framework/subscription","commits_url":"https://api.github.com/repos/donewell/django-rest-framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/donewell/django-rest-framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/donewell/django-rest-framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/donewell/django-rest-framework/issues/comments/{number}","contents_url":"https://api.github.com/repos/donewell/django-rest-framework/contents/{+path}","compare_url":"https://api.github.com/repos/donewell/django-rest-framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/donewell/django-rest-framework/merges","archive_url":"https://api.github.com/repos/donewell/django-rest-framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/donewell/django-rest-framework/downloads","issues_url":"https://api.github.com/repos/donewell/django-rest-framework/issues{/number}","pulls_url":"https://api.github.com/repos/donewell/django-rest-framework/pulls{/number}","milestones_url":"https://api.github.com/repos/donewell/django-rest-framework/milestones{/number}","notifications_url":"https://api.github.com/repos/donewell/django-rest-framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/donewell/django-rest-framework/labels{/name}","releases_url":"https://api.github.com/repos/donewell/django-rest-framework/releases{/id}","created_at":"2015-02-10T17:15:47Z","updated_at":"2015-02-10T17:15:49Z","pushed_at":"2015-02-10T20:14:58Z","git_url":"git://github.com/donewell/django-rest-framework.git","ssh_url":"git@github.com:donewell/django-rest-framework.git","clone_url":"https://github.com/donewell/django-rest-framework.git","svn_url":"https://github.com/donewell/django-rest-framework","homepage":"www.django-rest-framework.org","size":30295,"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":"b999db1c4614a0d6928b9ed204199fc4872f0341","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-11T06:22:23Z","pushed_at":"2015-02-10T22:56:09Z","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":30295,"stargazers_count":3553,"watchers_count":3553,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1083,"mirror_url":null,"open_issues_count":67,"forks":1083,"open_issues":67,"watchers":3553,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/2539"},"html":{"href":"https://github.com/tomchristie/django-rest-framework/pull/2539"},"issue":{"href":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2539"},"comments":{"href":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2539/comments"},"review_comments":{"href":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/2539/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/2539/commits"},"statuses":{"href":"https://api.github.com/repos/tomchristie/django-rest-framework/statuses/9ea615af14303663a47fd155ab541d8302d609e4"}}}}