{"action":"created","comment":{"url":"https://api.github.com/repos/inspirehep/inspire-next/pulls/comments/79583757","id":79583757,"diff_hunk":"@@ -24,3 +24,37 @@\n \"\"\"INSPIRE migrator load/dump audit.\"\"\"\n \n from __future__ import absolute_import, print_function\n+\n+import json\n+\n+from sqlalchemy.orm.exc import NoResultFound#, MultipleResultsFound\n+\n+def date_handler(obj):\n+    return obj.isoformat() if hasattr(obj, 'isoformat') else obj\n+\n+def get(*args, **kwargs):\n+    \"\"\"Get audits.\"\"\"\n+    from inspirehep.modules.audit.models import Audit\n+    q = Audit.query\n+    return q.count(), q.all()\n+\n+\n+def dump(record, from_date, **kwargs):\n+    \"\"\"Dump the audits as a list of dictionaries.\"\"\"\n+    from inspirehep.modules.audit.models import Audit\n+\n+    # First fetch all the audit information\n+    audit = {}\n+    try:\n+        return dict(id=record.id,\n+                             created=json.dumps(record.created, default=date_handler),\n+                             user_id=record.user_id,\n+                             object_id=record.object_id,\n+                             score = record.score,\n+                             user_action = record.user_action,\n+                             decision = record.decision,\n+                             source = record.source,\n+                             action = record.action)\n+    except NoResultFound:","path":"inspirehep/modules/migrator/legacy/audit.py","position":35,"original_position":35,"commit_id":"88c80a6a67d941e8fd8ec1ea3e71420af9e36848","original_commit_id":"88c80a6a67d941e8fd8ec1ea3e71420af9e36848","user":{"login":"Panos512","id":8779550,"avatar_url":"https://avatars.githubusercontent.com/u/8779550?v=3","gravatar_id":"","url":"https://api.github.com/users/Panos512","html_url":"https://github.com/Panos512","followers_url":"https://api.github.com/users/Panos512/followers","following_url":"https://api.github.com/users/Panos512/following{/other_user}","gists_url":"https://api.github.com/users/Panos512/gists{/gist_id}","starred_url":"https://api.github.com/users/Panos512/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Panos512/subscriptions","organizations_url":"https://api.github.com/users/Panos512/orgs","repos_url":"https://api.github.com/users/Panos512/repos","events_url":"https://api.github.com/users/Panos512/events{/privacy}","received_events_url":"https://api.github.com/users/Panos512/received_events","type":"User","site_admin":false},"body":"oops. Leftovers :D ","created_at":"2016-09-20T10:52:02Z","updated_at":"2016-09-20T10:52:02Z","html_url":"https://github.com/inspirehep/inspire-next/pull/1562#discussion_r79583757","pull_request_url":"https://api.github.com/repos/inspirehep/inspire-next/pulls/1562","_links":{"self":{"href":"https://api.github.com/repos/inspirehep/inspire-next/pulls/comments/79583757"},"html":{"href":"https://github.com/inspirehep/inspire-next/pull/1562#discussion_r79583757"},"pull_request":{"href":"https://api.github.com/repos/inspirehep/inspire-next/pulls/1562"}}},"pull_request":{"url":"https://api.github.com/repos/inspirehep/inspire-next/pulls/1562","id":85196655,"html_url":"https://github.com/inspirehep/inspire-next/pull/1562","diff_url":"https://github.com/inspirehep/inspire-next/pull/1562.diff","patch_url":"https://github.com/inspirehep/inspire-next/pull/1562.patch","issue_url":"https://api.github.com/repos/inspirehep/inspire-next/issues/1562","number":1562,"state":"open","locked":false,"title":"migrator: dump audit","user":{"login":"Panos512","id":8779550,"avatar_url":"https://avatars.githubusercontent.com/u/8779550?v=3","gravatar_id":"","url":"https://api.github.com/users/Panos512","html_url":"https://github.com/Panos512","followers_url":"https://api.github.com/users/Panos512/followers","following_url":"https://api.github.com/users/Panos512/following{/other_user}","gists_url":"https://api.github.com/users/Panos512/gists{/gist_id}","starred_url":"https://api.github.com/users/Panos512/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Panos512/subscriptions","organizations_url":"https://api.github.com/users/Panos512/orgs","repos_url":"https://api.github.com/users/Panos512/repos","events_url":"https://api.github.com/users/Panos512/events{/privacy}","received_events_url":"https://api.github.com/users/Panos512/received_events","type":"User","site_admin":false},"body":"* Adds dumping functionality for audit tables.","created_at":"2016-09-14T09:44:09Z","updated_at":"2016-09-20T10:52:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eb7a84ccb676de92507f01bc2acb765c79e5791b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/inspirehep/inspire-next/pulls/1562/commits","review_comments_url":"https://api.github.com/repos/inspirehep/inspire-next/pulls/1562/comments","review_comment_url":"https://api.github.com/repos/inspirehep/inspire-next/pulls/comments{/number}","comments_url":"https://api.github.com/repos/inspirehep/inspire-next/issues/1562/comments","statuses_url":"https://api.github.com/repos/inspirehep/inspire-next/statuses/88c80a6a67d941e8fd8ec1ea3e71420af9e36848","head":{"label":"inspirehep:dump_audit","ref":"dump_audit","sha":"88c80a6a67d941e8fd8ec1ea3e71420af9e36848","user":{"login":"inspirehep","id":356664,"avatar_url":"https://avatars.githubusercontent.com/u/356664?v=3","gravatar_id":"","url":"https://api.github.com/users/inspirehep","html_url":"https://github.com/inspirehep","followers_url":"https://api.github.com/users/inspirehep/followers","following_url":"https://api.github.com/users/inspirehep/following{/other_user}","gists_url":"https://api.github.com/users/inspirehep/gists{/gist_id}","starred_url":"https://api.github.com/users/inspirehep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inspirehep/subscriptions","organizations_url":"https://api.github.com/users/inspirehep/orgs","repos_url":"https://api.github.com/users/inspirehep/repos","events_url":"https://api.github.com/users/inspirehep/events{/privacy}","received_events_url":"https://api.github.com/users/inspirehep/received_events","type":"Organization","site_admin":false},"repo":{"id":15221515,"name":"inspire-next","full_name":"inspirehep/inspire-next","owner":{"login":"inspirehep","id":356664,"avatar_url":"https://avatars.githubusercontent.com/u/356664?v=3","gravatar_id":"","url":"https://api.github.com/users/inspirehep","html_url":"https://github.com/inspirehep","followers_url":"https://api.github.com/users/inspirehep/followers","following_url":"https://api.github.com/users/inspirehep/following{/other_user}","gists_url":"https://api.github.com/users/inspirehep/gists{/gist_id}","starred_url":"https://api.github.com/users/inspirehep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inspirehep/subscriptions","organizations_url":"https://api.github.com/users/inspirehep/orgs","repos_url":"https://api.github.com/users/inspirehep/repos","events_url":"https://api.github.com/users/inspirehep/events{/privacy}","received_events_url":"https://api.github.com/users/inspirehep/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/inspirehep/inspire-next","description":"The next version of INSPIRE","fork":false,"url":"https://api.github.com/repos/inspirehep/inspire-next","forks_url":"https://api.github.com/repos/inspirehep/inspire-next/forks","keys_url":"https://api.github.com/repos/inspirehep/inspire-next/keys{/key_id}","collaborators_url":"https://api.github.com/repos/inspirehep/inspire-next/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/inspirehep/inspire-next/teams","hooks_url":"https://api.github.com/repos/inspirehep/inspire-next/hooks","issue_events_url":"https://api.github.com/repos/inspirehep/inspire-next/issues/events{/number}","events_url":"https://api.github.com/repos/inspirehep/inspire-next/events","assignees_url":"https://api.github.com/repos/inspirehep/inspire-next/assignees{/user}","branches_url":"https://api.github.com/repos/inspirehep/inspire-next/branches{/branch}","tags_url":"https://api.github.com/repos/inspirehep/inspire-next/tags","blobs_url":"https://api.github.com/repos/inspirehep/inspire-next/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/inspirehep/inspire-next/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/inspirehep/inspire-next/git/refs{/sha}","trees_url":"https://api.github.com/repos/inspirehep/inspire-next/git/trees{/sha}","statuses_url":"https://api.github.com/repos/inspirehep/inspire-next/statuses/{sha}","languages_url":"https://api.github.com/repos/inspirehep/inspire-next/languages","stargazers_url":"https://api.github.com/repos/inspirehep/inspire-next/stargazers","contributors_url":"https://api.github.com/repos/inspirehep/inspire-next/contributors","subscribers_url":"https://api.github.com/repos/inspirehep/inspire-next/subscribers","subscription_url":"https://api.github.com/repos/inspirehep/inspire-next/subscription","commits_url":"https://api.github.com/repos/inspirehep/inspire-next/commits{/sha}","git_commits_url":"https://api.github.com/repos/inspirehep/inspire-next/git/commits{/sha}","comments_url":"https://api.github.com/repos/inspirehep/inspire-next/comments{/number}","issue_comment_url":"https://api.github.com/repos/inspirehep/inspire-next/issues/comments{/number}","contents_url":"https://api.github.com/repos/inspirehep/inspire-next/contents/{+path}","compare_url":"https://api.github.com/repos/inspirehep/inspire-next/compare/{base}...{head}","merges_url":"https://api.github.com/repos/inspirehep/inspire-next/merges","archive_url":"https://api.github.com/repos/inspirehep/inspire-next/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/inspirehep/inspire-next/downloads","issues_url":"https://api.github.com/repos/inspirehep/inspire-next/issues{/number}","pulls_url":"https://api.github.com/repos/inspirehep/inspire-next/pulls{/number}","milestones_url":"https://api.github.com/repos/inspirehep/inspire-next/milestones{/number}","notifications_url":"https://api.github.com/repos/inspirehep/inspire-next/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/inspirehep/inspire-next/labels{/name}","releases_url":"https://api.github.com/repos/inspirehep/inspire-next/releases{/id}","deployments_url":"https://api.github.com/repos/inspirehep/inspire-next/deployments","created_at":"2013-12-16T09:11:58Z","updated_at":"2016-08-31T23:29:11Z","pushed_at":"2016-09-20T10:10:41Z","git_url":"git://github.com/inspirehep/inspire-next.git","ssh_url":"git@github.com:inspirehep/inspire-next.git","clone_url":"https://github.com/inspirehep/inspire-next.git","svn_url":"https://github.com/inspirehep/inspire-next","homepage":"https://labs.inspirehep.net","size":65704,"stargazers_count":15,"watchers_count":15,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":165,"forks":34,"open_issues":165,"watchers":15,"default_branch":"master"}},"base":{"label":"inspirehep:production","ref":"production","sha":"16052a70e031df26e03ccb4de4919e5b9d4e72e8","user":{"login":"inspirehep","id":356664,"avatar_url":"https://avatars.githubusercontent.com/u/356664?v=3","gravatar_id":"","url":"https://api.github.com/users/inspirehep","html_url":"https://github.com/inspirehep","followers_url":"https://api.github.com/users/inspirehep/followers","following_url":"https://api.github.com/users/inspirehep/following{/other_user}","gists_url":"https://api.github.com/users/inspirehep/gists{/gist_id}","starred_url":"https://api.github.com/users/inspirehep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inspirehep/subscriptions","organizations_url":"https://api.github.com/users/inspirehep/orgs","repos_url":"https://api.github.com/users/inspirehep/repos","events_url":"https://api.github.com/users/inspirehep/events{/privacy}","received_events_url":"https://api.github.com/users/inspirehep/received_events","type":"Organization","site_admin":false},"repo":{"id":15221515,"name":"inspire-next","full_name":"inspirehep/inspire-next","owner":{"login":"inspirehep","id":356664,"avatar_url":"https://avatars.githubusercontent.com/u/356664?v=3","gravatar_id":"","url":"https://api.github.com/users/inspirehep","html_url":"https://github.com/inspirehep","followers_url":"https://api.github.com/users/inspirehep/followers","following_url":"https://api.github.com/users/inspirehep/following{/other_user}","gists_url":"https://api.github.com/users/inspirehep/gists{/gist_id}","starred_url":"https://api.github.com/users/inspirehep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inspirehep/subscriptions","organizations_url":"https://api.github.com/users/inspirehep/orgs","repos_url":"https://api.github.com/users/inspirehep/repos","events_url":"https://api.github.com/users/inspirehep/events{/privacy}","received_events_url":"https://api.github.com/users/inspirehep/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/inspirehep/inspire-next","description":"The next version of INSPIRE","fork":false,"url":"https://api.github.com/repos/inspirehep/inspire-next","forks_url":"https://api.github.com/repos/inspirehep/inspire-next/forks","keys_url":"https://api.github.com/repos/inspirehep/inspire-next/keys{/key_id}","collaborators_url":"https://api.github.com/repos/inspirehep/inspire-next/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/inspirehep/inspire-next/teams","hooks_url":"https://api.github.com/repos/inspirehep/inspire-next/hooks","issue_events_url":"https://api.github.com/repos/inspirehep/inspire-next/issues/events{/number}","events_url":"https://api.github.com/repos/inspirehep/inspire-next/events","assignees_url":"https://api.github.com/repos/inspirehep/inspire-next/assignees{/user}","branches_url":"https://api.github.com/repos/inspirehep/inspire-next/branches{/branch}","tags_url":"https://api.github.com/repos/inspirehep/inspire-next/tags","blobs_url":"https://api.github.com/repos/inspirehep/inspire-next/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/inspirehep/inspire-next/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/inspirehep/inspire-next/git/refs{/sha}","trees_url":"https://api.github.com/repos/inspirehep/inspire-next/git/trees{/sha}","statuses_url":"https://api.github.com/repos/inspirehep/inspire-next/statuses/{sha}","languages_url":"https://api.github.com/repos/inspirehep/inspire-next/languages","stargazers_url":"https://api.github.com/repos/inspirehep/inspire-next/stargazers","contributors_url":"https://api.github.com/repos/inspirehep/inspire-next/contributors","subscribers_url":"https://api.github.com/repos/inspirehep/inspire-next/subscribers","subscription_url":"https://api.github.com/repos/inspirehep/inspire-next/subscription","commits_url":"https://api.github.com/repos/inspirehep/inspire-next/commits{/sha}","git_commits_url":"https://api.github.com/repos/inspirehep/inspire-next/git/commits{/sha}","comments_url":"https://api.github.com/repos/inspirehep/inspire-next/comments{/number}","issue_comment_url":"https://api.github.com/repos/inspirehep/inspire-next/issues/comments{/number}","contents_url":"https://api.github.com/repos/inspirehep/inspire-next/contents/{+path}","compare_url":"https://api.github.com/repos/inspirehep/inspire-next/compare/{base}...{head}","merges_url":"https://api.github.com/repos/inspirehep/inspire-next/merges","archive_url":"https://api.github.com/repos/inspirehep/inspire-next/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/inspirehep/inspire-next/downloads","issues_url":"https://api.github.com/repos/inspirehep/inspire-next/issues{/number}","pulls_url":"https://api.github.com/repos/inspirehep/inspire-next/pulls{/number}","milestones_url":"https://api.github.com/repos/inspirehep/inspire-next/milestones{/number}","notifications_url":"https://api.github.com/repos/inspirehep/inspire-next/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/inspirehep/inspire-next/labels{/name}","releases_url":"https://api.github.com/repos/inspirehep/inspire-next/releases{/id}","deployments_url":"https://api.github.com/repos/inspirehep/inspire-next/deployments","created_at":"2013-12-16T09:11:58Z","updated_at":"2016-08-31T23:29:11Z","pushed_at":"2016-09-20T10:10:41Z","git_url":"git://github.com/inspirehep/inspire-next.git","ssh_url":"git@github.com:inspirehep/inspire-next.git","clone_url":"https://github.com/inspirehep/inspire-next.git","svn_url":"https://github.com/inspirehep/inspire-next","homepage":"https://labs.inspirehep.net","size":65704,"stargazers_count":15,"watchers_count":15,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":165,"forks":34,"open_issues":165,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/inspirehep/inspire-next/pulls/1562"},"html":{"href":"https://github.com/inspirehep/inspire-next/pull/1562"},"issue":{"href":"https://api.github.com/repos/inspirehep/inspire-next/issues/1562"},"comments":{"href":"https://api.github.com/repos/inspirehep/inspire-next/issues/1562/comments"},"review_comments":{"href":"https://api.github.com/repos/inspirehep/inspire-next/pulls/1562/comments"},"review_comment":{"href":"https://api.github.com/repos/inspirehep/inspire-next/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/inspirehep/inspire-next/pulls/1562/commits"},"statuses":{"href":"https://api.github.com/repos/inspirehep/inspire-next/statuses/88c80a6a67d941e8fd8ec1ea3e71420af9e36848"}}}}
{"actor":{"display_login":"Panos512"}}