{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/33046425","id":33046425,"diff_hunk":"@@ -0,0 +1,116 @@\n+class AccessResponse(object):\n+    \"\"\"Class that represents a response from a has_access permission check.\"\"\"\n+    def __init__(self, has_access, access_error):\n+        \"\"\"\n+        :param has_access (bool): if the user is granted access or not\n+        :param access_error (AccessError): None if granted access or in certain cases of denied access, otherwise\n+                                        contains specific information on why access was denied\n+        \"\"\"\n+        self.has_access = has_access\n+        self.access_error = access_error\n+        if has_access:\n+            assert access_error is None\n+\n+    def __nonzero__(self):\n+        \"\"\"Overrides bool() to correct truth value testing\"\"\"\n+        return self.has_access\n+\n+    def __eq__(self, other):\n+        return (\n+            isinstance(other, AccessResponse) and\n+            self.has_access == other.has_access and\n+            self.access_error == other.access_error\n+        )\n+\n+    def __hash__(self):\n+        return hash((self.has_access, self.access_error))\n+\n+    def to_json(self):\n+        \"\"\"Returns json representation of this AccessResponse\"\"\"\n+        return {\n+            \"has_access\": self.has_access,\n+            \"access_error\": self.access_error.to_json() if self.access_error is not None else None\n+        }\n+\n+\n+class AccessError(object):\n+    \"\"\"\n+    Class that holds information about the error in the case of an access denial in has_access.\n+    Contains the error code, user and developer messages. Subclasses represent specific errors.\n+    \"\"\"\n+    def __init__(self, error_code, developer_message, user_message):","path":"lms/djangoapps/courseware/access_response.py","position":41,"original_position":41,"commit_id":"db2efcfdb33f6c65e3d5b43cfc7e1f17266bf42e","original_commit_id":"db2efcfdb33f6c65e3d5b43cfc7e1f17266bf42e","user":{"login":"nasthagiri","id":6772826,"avatar_url":"https://avatars.githubusercontent.com/u/6772826?v=3","gravatar_id":"","url":"https://api.github.com/users/nasthagiri","html_url":"https://github.com/nasthagiri","followers_url":"https://api.github.com/users/nasthagiri/followers","following_url":"https://api.github.com/users/nasthagiri/following{/other_user}","gists_url":"https://api.github.com/users/nasthagiri/gists{/gist_id}","starred_url":"https://api.github.com/users/nasthagiri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nasthagiri/subscriptions","organizations_url":"https://api.github.com/users/nasthagiri/orgs","repos_url":"https://api.github.com/users/nasthagiri/repos","events_url":"https://api.github.com/users/nasthagiri/events{/privacy}","received_events_url":"https://api.github.com/users/nasthagiri/received_events","type":"User","site_admin":false},"body":"Make `developer_message` and  `user_message` as optional parameters.","created_at":"2015-06-23T14:28:45Z","updated_at":"2015-06-23T14:28:45Z","html_url":"https://github.com/edx/edx-platform/pull/8610#discussion_r33046425","pull_request_url":"https://api.github.com/repos/edx/edx-platform/pulls/8610","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/33046425"},"html":{"href":"https://github.com/edx/edx-platform/pull/8610#discussion_r33046425"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/8610"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/8610","id":38233717,"html_url":"https://github.com/edx/edx-platform/pull/8610","diff_url":"https://github.com/edx/edx-platform/pull/8610.diff","patch_url":"https://github.com/edx/edx-platform/pull/8610.patch","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/8610","number":8610,"state":"open","locked":false,"title":"WIP: lliu/changing has access","user":{"login":"tlindaliu","id":7157789,"avatar_url":"https://avatars.githubusercontent.com/u/7157789?v=3","gravatar_id":"","url":"https://api.github.com/users/tlindaliu","html_url":"https://github.com/tlindaliu","followers_url":"https://api.github.com/users/tlindaliu/followers","following_url":"https://api.github.com/users/tlindaliu/following{/other_user}","gists_url":"https://api.github.com/users/tlindaliu/gists{/gist_id}","starred_url":"https://api.github.com/users/tlindaliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlindaliu/subscriptions","organizations_url":"https://api.github.com/users/tlindaliu/orgs","repos_url":"https://api.github.com/users/tlindaliu/repos","events_url":"https://api.github.com/users/tlindaliu/events{/privacy}","received_events_url":"https://api.github.com/users/tlindaliu/received_events","type":"User","site_admin":false},"body":"I'm working off Kyle's branch, so the only file I added was access_response which has the new classes I've made.\r\n@nasthagiri, @BenjiLee fyi ","created_at":"2015-06-22T13:54:36Z","updated_at":"2015-06-23T14:28:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"05ef1eb5504ab261a871d67d8e306c32e6570a20","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-platform/pulls/8610/commits","review_comments_url":"https://api.github.com/repos/edx/edx-platform/pulls/8610/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/8610/comments","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/db2efcfdb33f6c65e3d5b43cfc7e1f17266bf42e","head":{"label":"edx:lliu/changing-has-access","ref":"lliu/changing-has-access","sha":"db2efcfdb33f6c65e3d5b43cfc7e1f17266bf42e","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","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=3","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":"The Open edX platform, the software that powers edX!","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":"2015-06-23T14:17:53Z","pushed_at":"2015-06-23T14:27:27Z","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://open.edx.org/","size":1925704,"stargazers_count":2002,"watchers_count":2002,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1148,"mirror_url":null,"open_issues_count":164,"forks":1148,"open_issues":164,"watchers":2002,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"473c6886551d3017f06d741f71576129ec1eaa00","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","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=3","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":"The Open edX platform, the software that powers edX!","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":"2015-06-23T14:17:53Z","pushed_at":"2015-06-23T14:27:27Z","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://open.edx.org/","size":1925704,"stargazers_count":2002,"watchers_count":2002,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1148,"mirror_url":null,"open_issues_count":164,"forks":1148,"open_issues":164,"watchers":2002,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/8610"},"html":{"href":"https://github.com/edx/edx-platform/pull/8610"},"issue":{"href":"https://api.github.com/repos/edx/edx-platform/issues/8610"},"comments":{"href":"https://api.github.com/repos/edx/edx-platform/issues/8610/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/8610/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/8610/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-platform/statuses/db2efcfdb33f6c65e3d5b43cfc7e1f17266bf42e"}}}}