GitHub PullRequestReviewCommentEvent at 2014-08-14 15:25:45
Repository: invenio
Actor: greut
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/inveniosoftware/invenio/pulls/comments/16244660","id":16244660,"diff_hunk":"@@ -190,6 +190,74 @@ def get_errors(self):\n         return found_errors\n \n \n+# a method that paginates data and generates link headers\n+def paginate(data, page_requested=1, endpoint=''):\n+    \"\"\" Paginates data and generates links to be added to the response header.\n+\n+    :param data: the data to be paginated\n+    :param page_requested: the number of the requested page\n+    :param endpoint: the url of the request\n+    \"\"\"\n+    from invenio.utils.pagination import Pagination\n+\n+    # data to be returned\n+    data_to_return = []\n+    # links string\n+    links_string = \"\"\n+\n+    # pagination object\n+    pagination = Pagination(page=page_requested, per_page=10,\n+                            total_count=len(data))\n+    if pagination.pages == 1:\n+        # the total number of pages is one\n+        # so the links will have first and last\n+        rel_first = \"<{0}&page={1}>; rel=\\\"first\\\"\".format(endpoint,\n+                                                           pagination.pages)\n+        rel_last = \"<{0}&page={1}>; rel=\\\"last\\\"\".format(endpoint,\n+                                                         pagination.pages)","path":"invenio/ext/restful/__init__.py","position":28,"original_position":28,"commit_id":"c67c1a155c1c2e020c6f2b60d34051183402d626","original_commit_id":"31e31b2d751ec998a79eeacdda7fc16395710d96","user":{"login":"greut","id":1388,"avatar_url":"https://avatars.githubusercontent.com/u/1388?v=2","gravatar_id":"9d55b716ad53ca9967afbbccf2828e9e","url":"https://api.github.com/users/greut","html_url":"https://github.com/greut","followers_url":"https://api.github.com/users/greut/followers","following_url":"https://api.github.com/users/greut/following{/other_user}","gists_url":"https://api.github.com/users/greut/gists{/gist_id}","starred_url":"https://api.github.com/users/greut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greut/subscriptions","organizations_url":"https://api.github.com/users/greut/orgs","repos_url":"https://api.github.com/users/greut/repos","events_url":"https://api.github.com/users/greut/events{/privacy}","received_events_url":"https://api.github.com/users/greut/received_events","type":"User","site_admin":false},"body":"@konstantinos1991 If you can, please avoid doing that.\r\n\r\n> After an application obtains an access token, it sends the token to a Google API in an HTTP authorization header. **It is possible to send tokens as URI query-string parameters, but we don't recommend it, because URI parameters can end up in log files that are not completely secure.** Also, it is good REST practice to avoid creating unnecessary URI parameter names.\r\n> https://developers.google.com/accounts/docs/OAuth2#basicsteps","created_at":"2014-08-14T15:25:45Z","updated_at":"2014-08-14T15:25:45Z","html_url":"https://github.com/inveniosoftware/invenio/pull/2087#discussion_r16244660","pull_request_url":"https://api.github.com/repos/inveniosoftware/invenio/pulls/2087","_links":{"self":{"href":"https://api.github.com/repos/inveniosoftware/invenio/pulls/comments/16244660"},"html":{"href":"https://github.com/inveniosoftware/invenio/pull/2087#discussion_r16244660"},"pull_request":{"href":"https://api.github.com/repos/inveniosoftware/invenio/pulls/2087"}}},"pull_request":{"url":"https://api.github.com/repos/inveniosoftware/invenio/pulls/2087","id":19786785,"html_url":"https://github.com/inveniosoftware/invenio/pull/2087","diff_url":"https://github.com/inveniosoftware/invenio/pull/2087.diff","patch_url":"https://github.com/inveniosoftware/invenio/pull/2087.patch","issue_url":"https://api.github.com/repos/inveniosoftware/invenio/issues/2087","number":2087,"state":"open","locked":false,"title":"WIP restful: addition of pagination","user":{"login":"konstantinos1991","id":2995029,"avatar_url":"https://avatars.githubusercontent.com/u/2995029?v=2","gravatar_id":"5253208af1a8c11999feee548e92a9fc","url":"https://api.github.com/users/konstantinos1991","html_url":"https://github.com/konstantinos1991","followers_url":"https://api.github.com/users/konstantinos1991/followers","following_url":"https://api.github.com/users/konstantinos1991/following{/other_user}","gists_url":"https://api.github.com/users/konstantinos1991/gists{/gist_id}","starred_url":"https://api.github.com/users/konstantinos1991/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/konstantinos1991/subscriptions","organizations_url":"https://api.github.com/users/konstantinos1991/orgs","repos_url":"https://api.github.com/users/konstantinos1991/repos","events_url":"https://api.github.com/users/konstantinos1991/events{/privacy}","received_events_url":"https://api.github.com/users/konstantinos1991/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-08-14T13:23:44Z","updated_at":"2014-08-14T15:25:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8b21b19cac6205f0a04bc1806030e128f2401729","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/inveniosoftware/invenio/pulls/2087/commits","review_comments_url":"https://api.github.com/repos/inveniosoftware/invenio/pulls/2087/comments","review_comment_url":"https://api.github.com/repos/inveniosoftware/invenio/pulls/comments/{number}","comments_url":"https://api.github.com/repos/inveniosoftware/invenio/issues/2087/comments","statuses_url":"https://api.github.com/repos/inveniosoftware/invenio/statuses/c67c1a155c1c2e020c6f2b60d34051183402d626","head":{"label":"konstantinos1991:pu-restful-pagination","ref":"pu-restful-pagination","sha":"c67c1a155c1c2e020c6f2b60d34051183402d626","user":{"login":"konstantinos1991","id":2995029,"avatar_url":"https://avatars.githubusercontent.com/u/2995029?v=2","gravatar_id":"5253208af1a8c11999feee548e92a9fc","url":"https://api.github.com/users/konstantinos1991","html_url":"https://github.com/konstantinos1991","followers_url":"https://api.github.com/users/konstantinos1991/followers","following_url":"https://api.github.com/users/konstantinos1991/following{/other_user}","gists_url":"https://api.github.com/users/konstantinos1991/gists{/gist_id}","starred_url":"https://api.github.com/users/konstantinos1991/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/konstantinos1991/subscriptions","organizations_url":"https://api.github.com/users/konstantinos1991/orgs","repos_url":"https://api.github.com/users/konstantinos1991/repos","events_url":"https://api.github.com/users/konstantinos1991/events{/privacy}","received_events_url":"https://api.github.com/users/konstantinos1991/received_events","type":"User","site_admin":false},"repo":{"id":19613073,"name":"invenio","full_name":"konstantinos1991/invenio","owner":{"login":"konstantinos1991","id":2995029,"avatar_url":"https://avatars.githubusercontent.com/u/2995029?v=2","gravatar_id":"5253208af1a8c11999feee548e92a9fc","url":"https://api.github.com/users/konstantinos1991","html_url":"https://github.com/konstantinos1991","followers_url":"https://api.github.com/users/konstantinos1991/followers","following_url":"https://api.github.com/users/konstantinos1991/following{/other_user}","gists_url":"https://api.github.com/users/konstantinos1991/gists{/gist_id}","starred_url":"https://api.github.com/users/konstantinos1991/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/konstantinos1991/subscriptions","organizations_url":"https://api.github.com/users/konstantinos1991/orgs","repos_url":"https://api.github.com/users/konstantinos1991/repos","events_url":"https://api.github.com/users/konstantinos1991/events{/privacy}","received_events_url":"https://api.github.com/users/konstantinos1991/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/konstantinos1991/invenio","description":"Invenio digital library software","fork":true,"url":"https://api.github.com/repos/konstantinos1991/invenio","forks_url":"https://api.github.com/repos/konstantinos1991/invenio/forks","keys_url":"https://api.github.com/repos/konstantinos1991/invenio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/konstantinos1991/invenio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/konstantinos1991/invenio/teams","hooks_url":"https://api.github.com/repos/konstantinos1991/invenio/hooks","issue_events_url":"https://api.github.com/repos/konstantinos1991/invenio/issues/events{/number}","events_url":"https://api.github.com/repos/konstantinos1991/invenio/events","assignees_url":"https://api.github.com/repos/konstantinos1991/invenio/assignees{/user}","branches_url":"https://api.github.com/repos/konstantinos1991/invenio/branches{/branch}","tags_url":"https://api.github.com/repos/konstantinos1991/invenio/tags","blobs_url":"https://api.github.com/repos/konstantinos1991/invenio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/konstantinos1991/invenio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/konstantinos1991/invenio/git/refs{/sha}","trees_url":"https://api.github.com/repos/konstantinos1991/invenio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/konstantinos1991/invenio/statuses/{sha}","languages_url":"https://api.github.com/repos/konstantinos1991/invenio/languages","stargazers_url":"https://api.github.com/repos/konstantinos1991/invenio/stargazers","contributors_url":"https://api.github.com/repos/konstantinos1991/invenio/contributors","subscribers_url":"https://api.github.com/repos/konstantinos1991/invenio/subscribers","subscription_url":"https://api.github.com/repos/konstantinos1991/invenio/subscription","commits_url":"https://api.github.com/repos/konstantinos1991/invenio/commits{/sha}","git_commits_url":"https://api.github.com/repos/konstantinos1991/invenio/git/commits{/sha}","comments_url":"https://api.github.com/repos/konstantinos1991/invenio/comments{/number}","issue_comment_url":"https://api.github.com/repos/konstantinos1991/invenio/issues/comments/{number}","contents_url":"https://api.github.com/repos/konstantinos1991/invenio/contents/{+path}","compare_url":"https://api.github.com/repos/konstantinos1991/invenio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/konstantinos1991/invenio/merges","archive_url":"https://api.github.com/repos/konstantinos1991/invenio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/konstantinos1991/invenio/downloads","issues_url":"https://api.github.com/repos/konstantinos1991/invenio/issues{/number}","pulls_url":"https://api.github.com/repos/konstantinos1991/invenio/pulls{/number}","milestones_url":"https://api.github.com/repos/konstantinos1991/invenio/milestones{/number}","notifications_url":"https://api.github.com/repos/konstantinos1991/invenio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/konstantinos1991/invenio/labels{/name}","releases_url":"https://api.github.com/repos/konstantinos1991/invenio/releases{/id}","created_at":"2014-05-09T14:03:21Z","updated_at":"2014-06-27T12:38:38Z","pushed_at":"2014-08-14T13:40:50Z","git_url":"git://github.com/konstantinos1991/invenio.git","ssh_url":"git@github.com:konstantinos1991/invenio.git","clone_url":"https://github.com/konstantinos1991/invenio.git","svn_url":"https://github.com/konstantinos1991/invenio","homepage":"http://invenio-software.org/","size":68977,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"pu"}},"base":{"label":"inveniosoftware:pu","ref":"pu","sha":"1ec9fe2b084729d41d876f0b4275f92a52399069","user":{"login":"inveniosoftware","id":1157480,"avatar_url":"https://avatars.githubusercontent.com/u/1157480?v=2","gravatar_id":"25650f49a3bc31a0bd99e1e9cb18255b","url":"https://api.github.com/users/inveniosoftware","html_url":"https://github.com/inveniosoftware","followers_url":"https://api.github.com/users/inveniosoftware/followers","following_url":"https://api.github.com/users/inveniosoftware/following{/other_user}","gists_url":"https://api.github.com/users/inveniosoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/inveniosoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inveniosoftware/subscriptions","organizations_url":"https://api.github.com/users/inveniosoftware/orgs","repos_url":"https://api.github.com/users/inveniosoftware/repos","events_url":"https://api.github.com/users/inveniosoftware/events{/privacy}","received_events_url":"https://api.github.com/users/inveniosoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":2665618,"name":"invenio","full_name":"inveniosoftware/invenio","owner":{"login":"inveniosoftware","id":1157480,"avatar_url":"https://avatars.githubusercontent.com/u/1157480?v=2","gravatar_id":"25650f49a3bc31a0bd99e1e9cb18255b","url":"https://api.github.com/users/inveniosoftware","html_url":"https://github.com/inveniosoftware","followers_url":"https://api.github.com/users/inveniosoftware/followers","following_url":"https://api.github.com/users/inveniosoftware/following{/other_user}","gists_url":"https://api.github.com/users/inveniosoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/inveniosoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inveniosoftware/subscriptions","organizations_url":"https://api.github.com/users/inveniosoftware/orgs","repos_url":"https://api.github.com/users/inveniosoftware/repos","events_url":"https://api.github.com/users/inveniosoftware/events{/privacy}","received_events_url":"https://api.github.com/users/inveniosoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/inveniosoftware/invenio","description":"Invenio digital library software","fork":false,"url":"https://api.github.com/repos/inveniosoftware/invenio","forks_url":"https://api.github.com/repos/inveniosoftware/invenio/forks","keys_url":"https://api.github.com/repos/inveniosoftware/invenio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/inveniosoftware/invenio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/inveniosoftware/invenio/teams","hooks_url":"https://api.github.com/repos/inveniosoftware/invenio/hooks","issue_events_url":"https://api.github.com/repos/inveniosoftware/invenio/issues/events{/number}","events_url":"https://api.github.com/repos/inveniosoftware/invenio/events","assignees_url":"https://api.github.com/repos/inveniosoftware/invenio/assignees{/user}","branches_url":"https://api.github.com/repos/inveniosoftware/invenio/branches{/branch}","tags_url":"https://api.github.com/repos/inveniosoftware/invenio/tags","blobs_url":"https://api.github.com/repos/inveniosoftware/invenio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/inveniosoftware/invenio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/inveniosoftware/invenio/git/refs{/sha}","trees_url":"https://api.github.com/repos/inveniosoftware/invenio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/inveniosoftware/invenio/statuses/{sha}","languages_url":"https://api.github.com/repos/inveniosoftware/invenio/languages","stargazers_url":"https://api.github.com/repos/inveniosoftware/invenio/stargazers","contributors_url":"https://api.github.com/repos/inveniosoftware/invenio/contributors","subscribers_url":"https://api.github.com/repos/inveniosoftware/invenio/subscribers","subscription_url":"https://api.github.com/repos/inveniosoftware/invenio/subscription","commits_url":"https://api.github.com/repos/inveniosoftware/invenio/commits{/sha}","git_commits_url":"https://api.github.com/repos/inveniosoftware/invenio/git/commits{/sha}","comments_url":"https://api.github.com/repos/inveniosoftware/invenio/comments{/number}","issue_comment_url":"https://api.github.com/repos/inveniosoftware/invenio/issues/comments/{number}","contents_url":"https://api.github.com/repos/inveniosoftware/invenio/contents/{+path}","compare_url":"https://api.github.com/repos/inveniosoftware/invenio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/inveniosoftware/invenio/merges","archive_url":"https://api.github.com/repos/inveniosoftware/invenio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/inveniosoftware/invenio/downloads","issues_url":"https://api.github.com/repos/inveniosoftware/invenio/issues{/number}","pulls_url":"https://api.github.com/repos/inveniosoftware/invenio/pulls{/number}","milestones_url":"https://api.github.com/repos/inveniosoftware/invenio/milestones{/number}","notifications_url":"https://api.github.com/repos/inveniosoftware/invenio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/inveniosoftware/invenio/labels{/name}","releases_url":"https://api.github.com/repos/inveniosoftware/invenio/releases{/id}","created_at":"2011-10-28T14:33:51Z","updated_at":"2014-08-12T20:23:27Z","pushed_at":"2014-08-14T14:55:25Z","git_url":"git://github.com/inveniosoftware/invenio.git","ssh_url":"git@github.com:inveniosoftware/invenio.git","clone_url":"https://github.com/inveniosoftware/invenio.git","svn_url":"https://github.com/inveniosoftware/invenio","homepage":"http://invenio-software.org/","size":78799,"stargazers_count":23,"watchers_count":23,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":80,"mirror_url":null,"open_issues_count":887,"forks":80,"open_issues":887,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/inveniosoftware/invenio/pulls/2087"},"html":{"href":"https://github.com/inveniosoftware/invenio/pull/2087"},"issue":{"href":"https://api.github.com/repos/inveniosoftware/invenio/issues/2087"},"comments":{"href":"https://api.github.com/repos/inveniosoftware/invenio/issues/2087/comments"},"review_comments":{"href":"https://api.github.com/repos/inveniosoftware/invenio/pulls/2087/comments"},"review_comment":{"href":"https://api.github.com/repos/inveniosoftware/invenio/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/inveniosoftware/invenio/pulls/2087/commits"},"statuses":{"href":"https://api.github.com/repos/inveniosoftware/invenio/statuses/c67c1a155c1c2e020c6f2b60d34051183402d626"}}}}