{"action":"created","comment":{"url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/pulls/comments/212670080","pull_request_review_id":149355381,"id":212670080,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMjY3MDA4MA==","diff_hunk":"@@ -36,42 +36,35 @@\n @implementer(IGrantInfo)\n class AnnotationGrantInfo(object):\n \n-    prinper = prinrole = permrole = {}\n-\n     def __init__(self, context):\n         self._context = context\n-        annotations = IAnnotations(context, None)\n-        if annotations is not None:\n+        annotations = IAnnotations(context, {})\n \n-            prinper = annotations.get(prinperkey)\n-            if prinper is not None:\n-                self.prinper = prinper._bycol  # by principals\n+        # by principals\n+        prinper = annotations.get(prinperkey)\n+        self.prinper = prinper._bycol if prinper is not None else {}\n \n-            prinrole = annotations.get(prinrolekey)\n-            if prinrole is not None:\n-                self.prinrole = prinrole._bycol  # by principals\n+        # by principals\n+        prinrole = annotations.get(prinrolekey)\n+        self.prinrole = prinrole._bycol if prinrole is not None else {}\n \n-            roleper = annotations.get(rolepermkey)\n-            if roleper is not None:\n-                self.permrole = roleper._byrow  # by permission\n+        # by permission\n+        roleper = annotations.get(rolepermkey)\n+        self.permrole = roleper._byrow if roleper is not None else {}\n \n-    def __nonzero__(self):\n+    def __bool__(self):\n         return bool(self.prinper or self.prinrole or self.permrole)\n \n+    __nonzero__ = __bool__\n+\n     def principalPermissionGrant(self, principal, permission):\n-        prinper = self.prinper.get(principal)\n-        if prinper:\n-            return prinper.get(permission, Unset)\n-        return Unset\n+        prinper = self.prinper.get(principal, {})\n+        return prinper.get(permission, Unset)\n \n     def getRolesForPermission(self, permission):\n-        permrole = self.permrole.get(permission)\n-        if permrole:\n-            return permrole.items()\n-        return ()\n+        permrole = self.permrole.get(permission, {})\n+        return list(permrole.items())\n \n     def getRolesForPrincipal(self, principal):\n-        prinrole = self.prinrole.get(principal)\n-        if prinrole:\n-            return prinrole.items()\n-        return ()\n+        prinrole = self.prinrole.get(principal, {})\n+        return list(prinrole.items())","path":"src/zope/securitypolicy/grantinfo.py","position":61,"original_position":61,"commit_id":"ad6c984d311d36b4f14a9dc37c939b91379e7af4","original_commit_id":"ad6c984d311d36b4f14a9dc37c939b91379e7af4","user":{"login":"mgedmin","id":159967,"node_id":"MDQ6VXNlcjE1OTk2Nw==","avatar_url":"https://avatars3.githubusercontent.com/u/159967?v=4","gravatar_id":"","url":"https://api.github.com/users/mgedmin","html_url":"https://github.com/mgedmin","followers_url":"https://api.github.com/users/mgedmin/followers","following_url":"https://api.github.com/users/mgedmin/following{/other_user}","gists_url":"https://api.github.com/users/mgedmin/gists{/gist_id}","starred_url":"https://api.github.com/users/mgedmin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgedmin/subscriptions","organizations_url":"https://api.github.com/users/mgedmin/orgs","repos_url":"https://api.github.com/users/mgedmin/repos","events_url":"https://api.github.com/users/mgedmin/events{/privacy}","received_events_url":"https://api.github.com/users/mgedmin/received_events","type":"User","site_admin":false},"body":"Nah, your arguments sound very convincing.","created_at":"2018-08-24T15:40:15Z","updated_at":"2018-08-24T15:40:16Z","html_url":"https://github.com/zopefoundation/zope.securitypolicy/pull/12#discussion_r212670080","pull_request_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/pulls/12","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/pulls/comments/212670080"},"html":{"href":"https://github.com/zopefoundation/zope.securitypolicy/pull/12#discussion_r212670080"},"pull_request":{"href":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/pulls/12"}},"in_reply_to_id":212650893},"pull_request":{"url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/pulls/12","id":210743840,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwNzQzODQw","html_url":"https://github.com/zopefoundation/zope.securitypolicy/pull/12","diff_url":"https://github.com/zopefoundation/zope.securitypolicy/pull/12.diff","patch_url":"https://github.com/zopefoundation/zope.securitypolicy/pull/12.patch","issue_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/issues/12","number":12,"state":"open","locked":false,"title":"100% coverage","user":{"login":"jamadden","id":1256082,"node_id":"MDQ6VXNlcjEyNTYwODI=","avatar_url":"https://avatars3.githubusercontent.com/u/1256082?v=4","gravatar_id":"","url":"https://api.github.com/users/jamadden","html_url":"https://github.com/jamadden","followers_url":"https://api.github.com/users/jamadden/followers","following_url":"https://api.github.com/users/jamadden/following{/other_user}","gists_url":"https://api.github.com/users/jamadden/gists{/gist_id}","starred_url":"https://api.github.com/users/jamadden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamadden/subscriptions","organizations_url":"https://api.github.com/users/jamadden/orgs","repos_url":"https://api.github.com/users/jamadden/repos","events_url":"https://api.github.com/users/jamadden/events{/privacy}","received_events_url":"https://api.github.com/users/jamadden/received_events","type":"User","site_admin":false},"body":"Fixes #10 \r\n\r\nCurrently based on #11 so that CI will run.","created_at":"2018-08-24T13:41:07Z","updated_at":"2018-08-24T15:40:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"110bd6ec475689f9085bd23490b7c1f0db57ec58","assignee":null,"assignees":[],"requested_reviewers":[{"login":"icemac","id":386619,"node_id":"MDQ6VXNlcjM4NjYxOQ==","avatar_url":"https://avatars1.githubusercontent.com/u/386619?v=4","gravatar_id":"","url":"https://api.github.com/users/icemac","html_url":"https://github.com/icemac","followers_url":"https://api.github.com/users/icemac/followers","following_url":"https://api.github.com/users/icemac/following{/other_user}","gists_url":"https://api.github.com/users/icemac/gists{/gist_id}","starred_url":"https://api.github.com/users/icemac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icemac/subscriptions","organizations_url":"https://api.github.com/users/icemac/orgs","repos_url":"https://api.github.com/users/icemac/repos","events_url":"https://api.github.com/users/icemac/events{/privacy}","received_events_url":"https://api.github.com/users/icemac/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/pulls/12/commits","review_comments_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/pulls/12/comments","review_comment_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/issues/12/comments","statuses_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/statuses/ad6c984d311d36b4f14a9dc37c939b91379e7af4","head":{"label":"zopefoundation:100coverage","ref":"100coverage","sha":"ad6c984d311d36b4f14a9dc37c939b91379e7af4","user":{"login":"zopefoundation","id":1163184,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNjMxODQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1163184?v=4","gravatar_id":"","url":"https://api.github.com/users/zopefoundation","html_url":"https://github.com/zopefoundation","followers_url":"https://api.github.com/users/zopefoundation/followers","following_url":"https://api.github.com/users/zopefoundation/following{/other_user}","gists_url":"https://api.github.com/users/zopefoundation/gists{/gist_id}","starred_url":"https://api.github.com/users/zopefoundation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zopefoundation/subscriptions","organizations_url":"https://api.github.com/users/zopefoundation/orgs","repos_url":"https://api.github.com/users/zopefoundation/repos","events_url":"https://api.github.com/users/zopefoundation/events{/privacy}","received_events_url":"https://api.github.com/users/zopefoundation/received_events","type":"Organization","site_admin":false},"repo":{"id":8351126,"node_id":"MDEwOlJlcG9zaXRvcnk4MzUxMTI2","name":"zope.securitypolicy","full_name":"zopefoundation/zope.securitypolicy","owner":{"login":"zopefoundation","id":1163184,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNjMxODQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1163184?v=4","gravatar_id":"","url":"https://api.github.com/users/zopefoundation","html_url":"https://github.com/zopefoundation","followers_url":"https://api.github.com/users/zopefoundation/followers","following_url":"https://api.github.com/users/zopefoundation/following{/other_user}","gists_url":"https://api.github.com/users/zopefoundation/gists{/gist_id}","starred_url":"https://api.github.com/users/zopefoundation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zopefoundation/subscriptions","organizations_url":"https://api.github.com/users/zopefoundation/orgs","repos_url":"https://api.github.com/users/zopefoundation/repos","events_url":"https://api.github.com/users/zopefoundation/events{/privacy}","received_events_url":"https://api.github.com/users/zopefoundation/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zopefoundation/zope.securitypolicy","description":"Default Security Policy for Zope 3","fork":false,"url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy","forks_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/forks","keys_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/teams","hooks_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/hooks","issue_events_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/issues/events{/number}","events_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/events","assignees_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/assignees{/user}","branches_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/branches{/branch}","tags_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/tags","blobs_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/git/refs{/sha}","trees_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/statuses/{sha}","languages_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/languages","stargazers_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/stargazers","contributors_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/contributors","subscribers_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/subscribers","subscription_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/subscription","commits_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/commits{/sha}","git_commits_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/git/commits{/sha}","comments_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/comments{/number}","issue_comment_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/issues/comments{/number}","contents_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/contents/{+path}","compare_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/merges","archive_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/downloads","issues_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/issues{/number}","pulls_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/pulls{/number}","milestones_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/milestones{/number}","notifications_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/labels{/name}","releases_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/releases{/id}","deployments_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/deployments","created_at":"2013-02-22T05:30:08Z","updated_at":"2018-08-24T14:36:26Z","pushed_at":"2018-08-24T14:37:08Z","git_url":"git://github.com/zopefoundation/zope.securitypolicy.git","ssh_url":"git@github.com:zopefoundation/zope.securitypolicy.git","clone_url":"https://github.com/zopefoundation/zope.securitypolicy.git","svn_url":"https://github.com/zopefoundation/zope.securitypolicy","homepage":"","size":335,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":3,"open_issues":3,"watchers":2,"default_branch":"master"}},"base":{"label":"zopefoundation:master","ref":"master","sha":"8137fa4857e4ee7e08091b0c011cffd28bec390e","user":{"login":"zopefoundation","id":1163184,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNjMxODQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1163184?v=4","gravatar_id":"","url":"https://api.github.com/users/zopefoundation","html_url":"https://github.com/zopefoundation","followers_url":"https://api.github.com/users/zopefoundation/followers","following_url":"https://api.github.com/users/zopefoundation/following{/other_user}","gists_url":"https://api.github.com/users/zopefoundation/gists{/gist_id}","starred_url":"https://api.github.com/users/zopefoundation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zopefoundation/subscriptions","organizations_url":"https://api.github.com/users/zopefoundation/orgs","repos_url":"https://api.github.com/users/zopefoundation/repos","events_url":"https://api.github.com/users/zopefoundation/events{/privacy}","received_events_url":"https://api.github.com/users/zopefoundation/received_events","type":"Organization","site_admin":false},"repo":{"id":8351126,"node_id":"MDEwOlJlcG9zaXRvcnk4MzUxMTI2","name":"zope.securitypolicy","full_name":"zopefoundation/zope.securitypolicy","owner":{"login":"zopefoundation","id":1163184,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNjMxODQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1163184?v=4","gravatar_id":"","url":"https://api.github.com/users/zopefoundation","html_url":"https://github.com/zopefoundation","followers_url":"https://api.github.com/users/zopefoundation/followers","following_url":"https://api.github.com/users/zopefoundation/following{/other_user}","gists_url":"https://api.github.com/users/zopefoundation/gists{/gist_id}","starred_url":"https://api.github.com/users/zopefoundation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zopefoundation/subscriptions","organizations_url":"https://api.github.com/users/zopefoundation/orgs","repos_url":"https://api.github.com/users/zopefoundation/repos","events_url":"https://api.github.com/users/zopefoundation/events{/privacy}","received_events_url":"https://api.github.com/users/zopefoundation/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zopefoundation/zope.securitypolicy","description":"Default Security Policy for Zope 3","fork":false,"url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy","forks_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/forks","keys_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/teams","hooks_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/hooks","issue_events_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/issues/events{/number}","events_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/events","assignees_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/assignees{/user}","branches_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/branches{/branch}","tags_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/tags","blobs_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/git/refs{/sha}","trees_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/statuses/{sha}","languages_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/languages","stargazers_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/stargazers","contributors_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/contributors","subscribers_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/subscribers","subscription_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/subscription","commits_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/commits{/sha}","git_commits_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/git/commits{/sha}","comments_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/comments{/number}","issue_comment_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/issues/comments{/number}","contents_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/contents/{+path}","compare_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/merges","archive_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/downloads","issues_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/issues{/number}","pulls_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/pulls{/number}","milestones_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/milestones{/number}","notifications_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/labels{/name}","releases_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/releases{/id}","deployments_url":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/deployments","created_at":"2013-02-22T05:30:08Z","updated_at":"2018-08-24T14:36:26Z","pushed_at":"2018-08-24T14:37:08Z","git_url":"git://github.com/zopefoundation/zope.securitypolicy.git","ssh_url":"git@github.com:zopefoundation/zope.securitypolicy.git","clone_url":"https://github.com/zopefoundation/zope.securitypolicy.git","svn_url":"https://github.com/zopefoundation/zope.securitypolicy","homepage":"","size":335,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":3,"open_issues":3,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/pulls/12"},"html":{"href":"https://github.com/zopefoundation/zope.securitypolicy/pull/12"},"issue":{"href":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/issues/12"},"comments":{"href":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/zopefoundation/zope.securitypolicy/statuses/ad6c984d311d36b4f14a9dc37c939b91379e7af4"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"mgedmin"}}