{"action":"created","comment":{"url":"https://api.github.com/repos/ZeroCater/zc_events/pulls/comments/93085996","pull_request_review_id":13607143,"id":93085996,"diff_hunk":"@@ -0,0 +1,51 @@\n+import datetime\n+\n+\n+def _get_attr(model_instance, attr_name):\n+    attr_value = getattr(model_instance, attr_name)\n+\n+    if callable(attr_value):\n+        return attr_value()\n+    return attr_value\n+\n+\n+def model_to_dict(instance, included_attributes={}):\n+    \"\"\"Returns a native python dict corresponding to the selected attributes of a model instance.\n+\n+    Args:\n+        instance: model instance to serialize\n+        included_attributes: attributes or methods on instance.\n+            It should be formatted as {'attr_name_in_the_returned_dict': 'attr_name_on_instance'}\n+            attr_name_on_instance could be an attribute or a callable/method of the instance.\n+            You can also follow relationships as <relation>.<attribute> or <relation>.<some_function>.\n+            The relationship must be one-to-one. If it is one-to-many, the relationship attribute must be defined\n+            on instance.\n+    \"\"\"\n+    data = {}\n+\n+    for name, attr_name in included_attributes.iteritems():\n+\n+        attr_value = instance\n+        for attr in attr_name.split('.'):\n+            attr_value = _get_attr(attr_value, attr)\n+\n+            if not attr_value:\n+                break\n+\n+        # Ensure that attr_value is native python datatype\n+        if type(attr_value) in (type(datetime.date), type(datetime.datetime), type(datetime.time)):\n+            attr_value = str(attr_value)\n+\n+        data.setdefault(name, attr_value)\n+\n+    return data\n+\n+\n+def event_payload(resource_type, resource_id, user_id, meta):","path":"zc_events/utils.py","position":44,"original_position":44,"commit_id":"5b17a8ec4f07b5b6fbd5fdf511b025ffb09ec4a4","original_commit_id":"5b17a8ec4f07b5b6fbd5fdf511b025ffb09ec4a4","user":{"login":"hamedahmadi","id":1884778,"avatar_url":"https://avatars.githubusercontent.com/u/1884778?v=3","gravatar_id":"","url":"https://api.github.com/users/hamedahmadi","html_url":"https://github.com/hamedahmadi","followers_url":"https://api.github.com/users/hamedahmadi/followers","following_url":"https://api.github.com/users/hamedahmadi/following{/other_user}","gists_url":"https://api.github.com/users/hamedahmadi/gists{/gist_id}","starred_url":"https://api.github.com/users/hamedahmadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hamedahmadi/subscriptions","organizations_url":"https://api.github.com/users/hamedahmadi/orgs","repos_url":"https://api.github.com/users/hamedahmadi/repos","events_url":"https://api.github.com/users/hamedahmadi/events{/privacy}","received_events_url":"https://api.github.com/users/hamedahmadi/received_events","type":"User","site_admin":false},"body":"We have different kind of events. I thinks it is better if we call this `notification_event_payload`.","created_at":"2016-12-19T18:06:47Z","updated_at":"2016-12-19T18:06:47Z","html_url":"https://github.com/ZeroCater/zc_events/pull/21#discussion_r93085996","pull_request_url":"https://api.github.com/repos/ZeroCater/zc_events/pulls/21","_links":{"self":{"href":"https://api.github.com/repos/ZeroCater/zc_events/pulls/comments/93085996"},"html":{"href":"https://github.com/ZeroCater/zc_events/pull/21#discussion_r93085996"},"pull_request":{"href":"https://api.github.com/repos/ZeroCater/zc_events/pulls/21"}}},"pull_request":{"url":"https://api.github.com/repos/ZeroCater/zc_events/pulls/21","id":97822650,"html_url":"https://github.com/ZeroCater/zc_events/pull/21","diff_url":"https://github.com/ZeroCater/zc_events/pull/21.diff","patch_url":"https://github.com/ZeroCater/zc_events/pull/21.patch","issue_url":"https://api.github.com/repos/ZeroCater/zc_events/issues/21","number":21,"state":"open","locked":false,"title":"Theo/s3 tools","user":{"login":"tnsengimana","id":6565667,"avatar_url":"https://avatars.githubusercontent.com/u/6565667?v=3","gravatar_id":"","url":"https://api.github.com/users/tnsengimana","html_url":"https://github.com/tnsengimana","followers_url":"https://api.github.com/users/tnsengimana/followers","following_url":"https://api.github.com/users/tnsengimana/following{/other_user}","gists_url":"https://api.github.com/users/tnsengimana/gists{/gist_id}","starred_url":"https://api.github.com/users/tnsengimana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tnsengimana/subscriptions","organizations_url":"https://api.github.com/users/tnsengimana/orgs","repos_url":"https://api.github.com/users/tnsengimana/repos","events_url":"https://api.github.com/users/tnsengimana/events{/privacy}","received_events_url":"https://api.github.com/users/tnsengimana/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-13T19:52:00Z","updated_at":"2016-12-19T18:07:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"85272a6827a7680540120e14007ed66913e7a8fc","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ZeroCater/zc_events/pulls/21/commits","review_comments_url":"https://api.github.com/repos/ZeroCater/zc_events/pulls/21/comments","review_comment_url":"https://api.github.com/repos/ZeroCater/zc_events/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ZeroCater/zc_events/issues/21/comments","statuses_url":"https://api.github.com/repos/ZeroCater/zc_events/statuses/5b17a8ec4f07b5b6fbd5fdf511b025ffb09ec4a4","head":{"label":"ZeroCater:theo/s3_tools","ref":"theo/s3_tools","sha":"5b17a8ec4f07b5b6fbd5fdf511b025ffb09ec4a4","user":{"login":"ZeroCater","id":753195,"avatar_url":"https://avatars.githubusercontent.com/u/753195?v=3","gravatar_id":"","url":"https://api.github.com/users/ZeroCater","html_url":"https://github.com/ZeroCater","followers_url":"https://api.github.com/users/ZeroCater/followers","following_url":"https://api.github.com/users/ZeroCater/following{/other_user}","gists_url":"https://api.github.com/users/ZeroCater/gists{/gist_id}","starred_url":"https://api.github.com/users/ZeroCater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZeroCater/subscriptions","organizations_url":"https://api.github.com/users/ZeroCater/orgs","repos_url":"https://api.github.com/users/ZeroCater/repos","events_url":"https://api.github.com/users/ZeroCater/events{/privacy}","received_events_url":"https://api.github.com/users/ZeroCater/received_events","type":"Organization","site_admin":false},"repo":{"id":74609149,"name":"zc_events","full_name":"ZeroCater/zc_events","owner":{"login":"ZeroCater","id":753195,"avatar_url":"https://avatars.githubusercontent.com/u/753195?v=3","gravatar_id":"","url":"https://api.github.com/users/ZeroCater","html_url":"https://github.com/ZeroCater","followers_url":"https://api.github.com/users/ZeroCater/followers","following_url":"https://api.github.com/users/ZeroCater/following{/other_user}","gists_url":"https://api.github.com/users/ZeroCater/gists{/gist_id}","starred_url":"https://api.github.com/users/ZeroCater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZeroCater/subscriptions","organizations_url":"https://api.github.com/users/ZeroCater/orgs","repos_url":"https://api.github.com/users/ZeroCater/repos","events_url":"https://api.github.com/users/ZeroCater/events{/privacy}","received_events_url":"https://api.github.com/users/ZeroCater/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ZeroCater/zc_events","description":null,"fork":false,"url":"https://api.github.com/repos/ZeroCater/zc_events","forks_url":"https://api.github.com/repos/ZeroCater/zc_events/forks","keys_url":"https://api.github.com/repos/ZeroCater/zc_events/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ZeroCater/zc_events/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ZeroCater/zc_events/teams","hooks_url":"https://api.github.com/repos/ZeroCater/zc_events/hooks","issue_events_url":"https://api.github.com/repos/ZeroCater/zc_events/issues/events{/number}","events_url":"https://api.github.com/repos/ZeroCater/zc_events/events","assignees_url":"https://api.github.com/repos/ZeroCater/zc_events/assignees{/user}","branches_url":"https://api.github.com/repos/ZeroCater/zc_events/branches{/branch}","tags_url":"https://api.github.com/repos/ZeroCater/zc_events/tags","blobs_url":"https://api.github.com/repos/ZeroCater/zc_events/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ZeroCater/zc_events/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ZeroCater/zc_events/git/refs{/sha}","trees_url":"https://api.github.com/repos/ZeroCater/zc_events/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ZeroCater/zc_events/statuses/{sha}","languages_url":"https://api.github.com/repos/ZeroCater/zc_events/languages","stargazers_url":"https://api.github.com/repos/ZeroCater/zc_events/stargazers","contributors_url":"https://api.github.com/repos/ZeroCater/zc_events/contributors","subscribers_url":"https://api.github.com/repos/ZeroCater/zc_events/subscribers","subscription_url":"https://api.github.com/repos/ZeroCater/zc_events/subscription","commits_url":"https://api.github.com/repos/ZeroCater/zc_events/commits{/sha}","git_commits_url":"https://api.github.com/repos/ZeroCater/zc_events/git/commits{/sha}","comments_url":"https://api.github.com/repos/ZeroCater/zc_events/comments{/number}","issue_comment_url":"https://api.github.com/repos/ZeroCater/zc_events/issues/comments{/number}","contents_url":"https://api.github.com/repos/ZeroCater/zc_events/contents/{+path}","compare_url":"https://api.github.com/repos/ZeroCater/zc_events/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ZeroCater/zc_events/merges","archive_url":"https://api.github.com/repos/ZeroCater/zc_events/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ZeroCater/zc_events/downloads","issues_url":"https://api.github.com/repos/ZeroCater/zc_events/issues{/number}","pulls_url":"https://api.github.com/repos/ZeroCater/zc_events/pulls{/number}","milestones_url":"https://api.github.com/repos/ZeroCater/zc_events/milestones{/number}","notifications_url":"https://api.github.com/repos/ZeroCater/zc_events/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ZeroCater/zc_events/labels{/name}","releases_url":"https://api.github.com/repos/ZeroCater/zc_events/releases{/id}","deployments_url":"https://api.github.com/repos/ZeroCater/zc_events/deployments","created_at":"2016-11-23T19:50:45Z","updated_at":"2016-11-23T22:43:15Z","pushed_at":"2016-12-19T06:35:02Z","git_url":"git://github.com/ZeroCater/zc_events.git","ssh_url":"git@github.com:ZeroCater/zc_events.git","clone_url":"https://github.com/ZeroCater/zc_events.git","svn_url":"https://github.com/ZeroCater/zc_events","homepage":null,"size":99,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"ZeroCater:master","ref":"master","sha":"a47c3f911f761087759d180943210fa7a17912f0","user":{"login":"ZeroCater","id":753195,"avatar_url":"https://avatars.githubusercontent.com/u/753195?v=3","gravatar_id":"","url":"https://api.github.com/users/ZeroCater","html_url":"https://github.com/ZeroCater","followers_url":"https://api.github.com/users/ZeroCater/followers","following_url":"https://api.github.com/users/ZeroCater/following{/other_user}","gists_url":"https://api.github.com/users/ZeroCater/gists{/gist_id}","starred_url":"https://api.github.com/users/ZeroCater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZeroCater/subscriptions","organizations_url":"https://api.github.com/users/ZeroCater/orgs","repos_url":"https://api.github.com/users/ZeroCater/repos","events_url":"https://api.github.com/users/ZeroCater/events{/privacy}","received_events_url":"https://api.github.com/users/ZeroCater/received_events","type":"Organization","site_admin":false},"repo":{"id":74609149,"name":"zc_events","full_name":"ZeroCater/zc_events","owner":{"login":"ZeroCater","id":753195,"avatar_url":"https://avatars.githubusercontent.com/u/753195?v=3","gravatar_id":"","url":"https://api.github.com/users/ZeroCater","html_url":"https://github.com/ZeroCater","followers_url":"https://api.github.com/users/ZeroCater/followers","following_url":"https://api.github.com/users/ZeroCater/following{/other_user}","gists_url":"https://api.github.com/users/ZeroCater/gists{/gist_id}","starred_url":"https://api.github.com/users/ZeroCater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZeroCater/subscriptions","organizations_url":"https://api.github.com/users/ZeroCater/orgs","repos_url":"https://api.github.com/users/ZeroCater/repos","events_url":"https://api.github.com/users/ZeroCater/events{/privacy}","received_events_url":"https://api.github.com/users/ZeroCater/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ZeroCater/zc_events","description":null,"fork":false,"url":"https://api.github.com/repos/ZeroCater/zc_events","forks_url":"https://api.github.com/repos/ZeroCater/zc_events/forks","keys_url":"https://api.github.com/repos/ZeroCater/zc_events/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ZeroCater/zc_events/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ZeroCater/zc_events/teams","hooks_url":"https://api.github.com/repos/ZeroCater/zc_events/hooks","issue_events_url":"https://api.github.com/repos/ZeroCater/zc_events/issues/events{/number}","events_url":"https://api.github.com/repos/ZeroCater/zc_events/events","assignees_url":"https://api.github.com/repos/ZeroCater/zc_events/assignees{/user}","branches_url":"https://api.github.com/repos/ZeroCater/zc_events/branches{/branch}","tags_url":"https://api.github.com/repos/ZeroCater/zc_events/tags","blobs_url":"https://api.github.com/repos/ZeroCater/zc_events/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ZeroCater/zc_events/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ZeroCater/zc_events/git/refs{/sha}","trees_url":"https://api.github.com/repos/ZeroCater/zc_events/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ZeroCater/zc_events/statuses/{sha}","languages_url":"https://api.github.com/repos/ZeroCater/zc_events/languages","stargazers_url":"https://api.github.com/repos/ZeroCater/zc_events/stargazers","contributors_url":"https://api.github.com/repos/ZeroCater/zc_events/contributors","subscribers_url":"https://api.github.com/repos/ZeroCater/zc_events/subscribers","subscription_url":"https://api.github.com/repos/ZeroCater/zc_events/subscription","commits_url":"https://api.github.com/repos/ZeroCater/zc_events/commits{/sha}","git_commits_url":"https://api.github.com/repos/ZeroCater/zc_events/git/commits{/sha}","comments_url":"https://api.github.com/repos/ZeroCater/zc_events/comments{/number}","issue_comment_url":"https://api.github.com/repos/ZeroCater/zc_events/issues/comments{/number}","contents_url":"https://api.github.com/repos/ZeroCater/zc_events/contents/{+path}","compare_url":"https://api.github.com/repos/ZeroCater/zc_events/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ZeroCater/zc_events/merges","archive_url":"https://api.github.com/repos/ZeroCater/zc_events/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ZeroCater/zc_events/downloads","issues_url":"https://api.github.com/repos/ZeroCater/zc_events/issues{/number}","pulls_url":"https://api.github.com/repos/ZeroCater/zc_events/pulls{/number}","milestones_url":"https://api.github.com/repos/ZeroCater/zc_events/milestones{/number}","notifications_url":"https://api.github.com/repos/ZeroCater/zc_events/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ZeroCater/zc_events/labels{/name}","releases_url":"https://api.github.com/repos/ZeroCater/zc_events/releases{/id}","deployments_url":"https://api.github.com/repos/ZeroCater/zc_events/deployments","created_at":"2016-11-23T19:50:45Z","updated_at":"2016-11-23T22:43:15Z","pushed_at":"2016-12-19T06:35:02Z","git_url":"git://github.com/ZeroCater/zc_events.git","ssh_url":"git@github.com:ZeroCater/zc_events.git","clone_url":"https://github.com/ZeroCater/zc_events.git","svn_url":"https://github.com/ZeroCater/zc_events","homepage":null,"size":99,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ZeroCater/zc_events/pulls/21"},"html":{"href":"https://github.com/ZeroCater/zc_events/pull/21"},"issue":{"href":"https://api.github.com/repos/ZeroCater/zc_events/issues/21"},"comments":{"href":"https://api.github.com/repos/ZeroCater/zc_events/issues/21/comments"},"review_comments":{"href":"https://api.github.com/repos/ZeroCater/zc_events/pulls/21/comments"},"review_comment":{"href":"https://api.github.com/repos/ZeroCater/zc_events/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ZeroCater/zc_events/pulls/21/commits"},"statuses":{"href":"https://api.github.com/repos/ZeroCater/zc_events/statuses/5b17a8ec4f07b5b6fbd5fdf511b025ffb09ec4a4"}}}}
{"actor":{"display_login":"hamedahmadi"}}