{"action":"created","comment":{"url":"https://api.github.com/repos/hasgeek/boxoffice/pulls/comments/100087625","pull_request_review_id":20782231,"id":100087625,"diff_hunk":"@@ -52,12 +62,38 @@ def jsonify_discount_policies(data_dict):\n     )\n @render_with({'text/html': 'index.html', 'application/json': jsonify_discount_policies}, json=True)\n def admin_discount_policies(organization):\n+    RESULTS_PER_PAGE = 6\n     query = request.args.get('search')\n-    if query:\n-        discount_policies = DiscountPolicy.query.filter(DiscountPolicy.title.ilike('%{query}%'.format(query=query))).all()\n+    try:\n+        page = int(request.args.get('page', 1))\n+    except ValueError:","path":"boxoffice/views/admin_discount.py","position":53,"original_position":56,"commit_id":"f035fac18af1378540a549aa0f1cf402442f46b9","original_commit_id":"e631a27e1c95880a7d08bf1b6321c45e90ababcc","user":{"login":"shreyas-satish","id":380688,"avatar_url":"https://avatars.githubusercontent.com/u/380688?v=3","gravatar_id":"","url":"https://api.github.com/users/shreyas-satish","html_url":"https://github.com/shreyas-satish","followers_url":"https://api.github.com/users/shreyas-satish/followers","following_url":"https://api.github.com/users/shreyas-satish/following{/other_user}","gists_url":"https://api.github.com/users/shreyas-satish/gists{/gist_id}","starred_url":"https://api.github.com/users/shreyas-satish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shreyas-satish/subscriptions","organizations_url":"https://api.github.com/users/shreyas-satish/orgs","repos_url":"https://api.github.com/users/shreyas-satish/repos","events_url":"https://api.github.com/users/shreyas-satish/events{/privacy}","received_events_url":"https://api.github.com/users/shreyas-satish/received_events","type":"User","site_admin":false},"body":"I meant if we could use an `if/else` instead of using a `try/catch`. i.e\r\n\r\n```python\r\nif request.args.get('page'):\r\n    page = int(request.args.get('page'))\r\nelse:\r\n    page = 1\r\n```","created_at":"2017-02-08T15:16:06Z","updated_at":"2017-02-08T15:16:06Z","html_url":"https://github.com/hasgeek/boxoffice/pull/110#discussion_r100087625","pull_request_url":"https://api.github.com/repos/hasgeek/boxoffice/pulls/110","_links":{"self":{"href":"https://api.github.com/repos/hasgeek/boxoffice/pulls/comments/100087625"},"html":{"href":"https://github.com/hasgeek/boxoffice/pull/110#discussion_r100087625"},"pull_request":{"href":"https://api.github.com/repos/hasgeek/boxoffice/pulls/110"}}},"pull_request":{"url":"https://api.github.com/repos/hasgeek/boxoffice/pulls/110","id":89136748,"html_url":"https://github.com/hasgeek/boxoffice/pull/110","diff_url":"https://github.com/hasgeek/boxoffice/pull/110.diff","patch_url":"https://github.com/hasgeek/boxoffice/pull/110.patch","issue_url":"https://api.github.com/repos/hasgeek/boxoffice/issues/110","number":110,"state":"open","locked":false,"title":"Pagination for discount policies","user":{"login":"iambibhas","id":357253,"avatar_url":"https://avatars.githubusercontent.com/u/357253?v=3","gravatar_id":"","url":"https://api.github.com/users/iambibhas","html_url":"https://github.com/iambibhas","followers_url":"https://api.github.com/users/iambibhas/followers","following_url":"https://api.github.com/users/iambibhas/following{/other_user}","gists_url":"https://api.github.com/users/iambibhas/gists{/gist_id}","starred_url":"https://api.github.com/users/iambibhas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iambibhas/subscriptions","organizations_url":"https://api.github.com/users/iambibhas/orgs","repos_url":"https://api.github.com/users/iambibhas/repos","events_url":"https://api.github.com/users/iambibhas/events{/privacy}","received_events_url":"https://api.github.com/users/iambibhas/received_events","type":"User","site_admin":false},"body":"This adds a pagination bar at the bottom.\n\n![screenshot_20161013_102612](https://cloud.githubusercontent.com/assets/357253/19337113/810fc27c-912f-11e6-9368-6adb9d58a423.png)\n","created_at":"2016-10-13T04:57:23Z","updated_at":"2017-02-08T15:16:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c0d31ca6a0c091470be2ec2c9ae6edde966640c9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/hasgeek/boxoffice/pulls/110/commits","review_comments_url":"https://api.github.com/repos/hasgeek/boxoffice/pulls/110/comments","review_comment_url":"https://api.github.com/repos/hasgeek/boxoffice/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hasgeek/boxoffice/issues/110/comments","statuses_url":"https://api.github.com/repos/hasgeek/boxoffice/statuses/f035fac18af1378540a549aa0f1cf402442f46b9","head":{"label":"iambibhas:admin-discount","ref":"admin-discount","sha":"f035fac18af1378540a549aa0f1cf402442f46b9","user":{"login":"iambibhas","id":357253,"avatar_url":"https://avatars.githubusercontent.com/u/357253?v=3","gravatar_id":"","url":"https://api.github.com/users/iambibhas","html_url":"https://github.com/iambibhas","followers_url":"https://api.github.com/users/iambibhas/followers","following_url":"https://api.github.com/users/iambibhas/following{/other_user}","gists_url":"https://api.github.com/users/iambibhas/gists{/gist_id}","starred_url":"https://api.github.com/users/iambibhas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iambibhas/subscriptions","organizations_url":"https://api.github.com/users/iambibhas/orgs","repos_url":"https://api.github.com/users/iambibhas/repos","events_url":"https://api.github.com/users/iambibhas/events{/privacy}","received_events_url":"https://api.github.com/users/iambibhas/received_events","type":"User","site_admin":false},"repo":{"id":70769395,"name":"boxoffice","full_name":"iambibhas/boxoffice","owner":{"login":"iambibhas","id":357253,"avatar_url":"https://avatars.githubusercontent.com/u/357253?v=3","gravatar_id":"","url":"https://api.github.com/users/iambibhas","html_url":"https://github.com/iambibhas","followers_url":"https://api.github.com/users/iambibhas/followers","following_url":"https://api.github.com/users/iambibhas/following{/other_user}","gists_url":"https://api.github.com/users/iambibhas/gists{/gist_id}","starred_url":"https://api.github.com/users/iambibhas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iambibhas/subscriptions","organizations_url":"https://api.github.com/users/iambibhas/orgs","repos_url":"https://api.github.com/users/iambibhas/repos","events_url":"https://api.github.com/users/iambibhas/events{/privacy}","received_events_url":"https://api.github.com/users/iambibhas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/iambibhas/boxoffice","description":"Ticketing","fork":true,"url":"https://api.github.com/repos/iambibhas/boxoffice","forks_url":"https://api.github.com/repos/iambibhas/boxoffice/forks","keys_url":"https://api.github.com/repos/iambibhas/boxoffice/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iambibhas/boxoffice/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iambibhas/boxoffice/teams","hooks_url":"https://api.github.com/repos/iambibhas/boxoffice/hooks","issue_events_url":"https://api.github.com/repos/iambibhas/boxoffice/issues/events{/number}","events_url":"https://api.github.com/repos/iambibhas/boxoffice/events","assignees_url":"https://api.github.com/repos/iambibhas/boxoffice/assignees{/user}","branches_url":"https://api.github.com/repos/iambibhas/boxoffice/branches{/branch}","tags_url":"https://api.github.com/repos/iambibhas/boxoffice/tags","blobs_url":"https://api.github.com/repos/iambibhas/boxoffice/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iambibhas/boxoffice/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iambibhas/boxoffice/git/refs{/sha}","trees_url":"https://api.github.com/repos/iambibhas/boxoffice/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iambibhas/boxoffice/statuses/{sha}","languages_url":"https://api.github.com/repos/iambibhas/boxoffice/languages","stargazers_url":"https://api.github.com/repos/iambibhas/boxoffice/stargazers","contributors_url":"https://api.github.com/repos/iambibhas/boxoffice/contributors","subscribers_url":"https://api.github.com/repos/iambibhas/boxoffice/subscribers","subscription_url":"https://api.github.com/repos/iambibhas/boxoffice/subscription","commits_url":"https://api.github.com/repos/iambibhas/boxoffice/commits{/sha}","git_commits_url":"https://api.github.com/repos/iambibhas/boxoffice/git/commits{/sha}","comments_url":"https://api.github.com/repos/iambibhas/boxoffice/comments{/number}","issue_comment_url":"https://api.github.com/repos/iambibhas/boxoffice/issues/comments{/number}","contents_url":"https://api.github.com/repos/iambibhas/boxoffice/contents/{+path}","compare_url":"https://api.github.com/repos/iambibhas/boxoffice/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iambibhas/boxoffice/merges","archive_url":"https://api.github.com/repos/iambibhas/boxoffice/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iambibhas/boxoffice/downloads","issues_url":"https://api.github.com/repos/iambibhas/boxoffice/issues{/number}","pulls_url":"https://api.github.com/repos/iambibhas/boxoffice/pulls{/number}","milestones_url":"https://api.github.com/repos/iambibhas/boxoffice/milestones{/number}","notifications_url":"https://api.github.com/repos/iambibhas/boxoffice/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iambibhas/boxoffice/labels{/name}","releases_url":"https://api.github.com/repos/iambibhas/boxoffice/releases{/id}","deployments_url":"https://api.github.com/repos/iambibhas/boxoffice/deployments","created_at":"2016-10-13T04:38:56Z","updated_at":"2016-10-13T04:38:57Z","pushed_at":"2017-02-08T14:43:17Z","git_url":"git://github.com/iambibhas/boxoffice.git","ssh_url":"git@github.com:iambibhas/boxoffice.git","clone_url":"https://github.com/iambibhas/boxoffice.git","svn_url":"https://github.com/iambibhas/boxoffice","homepage":"","size":19818,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"hasgeek:admin-discount","ref":"admin-discount","sha":"57b2759eaf8f8dae2a0c5501b1e455ff48e35e19","user":{"login":"hasgeek","id":443850,"avatar_url":"https://avatars.githubusercontent.com/u/443850?v=3","gravatar_id":"","url":"https://api.github.com/users/hasgeek","html_url":"https://github.com/hasgeek","followers_url":"https://api.github.com/users/hasgeek/followers","following_url":"https://api.github.com/users/hasgeek/following{/other_user}","gists_url":"https://api.github.com/users/hasgeek/gists{/gist_id}","starred_url":"https://api.github.com/users/hasgeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hasgeek/subscriptions","organizations_url":"https://api.github.com/users/hasgeek/orgs","repos_url":"https://api.github.com/users/hasgeek/repos","events_url":"https://api.github.com/users/hasgeek/events{/privacy}","received_events_url":"https://api.github.com/users/hasgeek/received_events","type":"Organization","site_admin":false},"repo":{"id":3188285,"name":"boxoffice","full_name":"hasgeek/boxoffice","owner":{"login":"hasgeek","id":443850,"avatar_url":"https://avatars.githubusercontent.com/u/443850?v=3","gravatar_id":"","url":"https://api.github.com/users/hasgeek","html_url":"https://github.com/hasgeek","followers_url":"https://api.github.com/users/hasgeek/followers","following_url":"https://api.github.com/users/hasgeek/following{/other_user}","gists_url":"https://api.github.com/users/hasgeek/gists{/gist_id}","starred_url":"https://api.github.com/users/hasgeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hasgeek/subscriptions","organizations_url":"https://api.github.com/users/hasgeek/orgs","repos_url":"https://api.github.com/users/hasgeek/repos","events_url":"https://api.github.com/users/hasgeek/events{/privacy}","received_events_url":"https://api.github.com/users/hasgeek/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hasgeek/boxoffice","description":"Ticketing","fork":false,"url":"https://api.github.com/repos/hasgeek/boxoffice","forks_url":"https://api.github.com/repos/hasgeek/boxoffice/forks","keys_url":"https://api.github.com/repos/hasgeek/boxoffice/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hasgeek/boxoffice/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hasgeek/boxoffice/teams","hooks_url":"https://api.github.com/repos/hasgeek/boxoffice/hooks","issue_events_url":"https://api.github.com/repos/hasgeek/boxoffice/issues/events{/number}","events_url":"https://api.github.com/repos/hasgeek/boxoffice/events","assignees_url":"https://api.github.com/repos/hasgeek/boxoffice/assignees{/user}","branches_url":"https://api.github.com/repos/hasgeek/boxoffice/branches{/branch}","tags_url":"https://api.github.com/repos/hasgeek/boxoffice/tags","blobs_url":"https://api.github.com/repos/hasgeek/boxoffice/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hasgeek/boxoffice/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hasgeek/boxoffice/git/refs{/sha}","trees_url":"https://api.github.com/repos/hasgeek/boxoffice/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hasgeek/boxoffice/statuses/{sha}","languages_url":"https://api.github.com/repos/hasgeek/boxoffice/languages","stargazers_url":"https://api.github.com/repos/hasgeek/boxoffice/stargazers","contributors_url":"https://api.github.com/repos/hasgeek/boxoffice/contributors","subscribers_url":"https://api.github.com/repos/hasgeek/boxoffice/subscribers","subscription_url":"https://api.github.com/repos/hasgeek/boxoffice/subscription","commits_url":"https://api.github.com/repos/hasgeek/boxoffice/commits{/sha}","git_commits_url":"https://api.github.com/repos/hasgeek/boxoffice/git/commits{/sha}","comments_url":"https://api.github.com/repos/hasgeek/boxoffice/comments{/number}","issue_comment_url":"https://api.github.com/repos/hasgeek/boxoffice/issues/comments{/number}","contents_url":"https://api.github.com/repos/hasgeek/boxoffice/contents/{+path}","compare_url":"https://api.github.com/repos/hasgeek/boxoffice/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hasgeek/boxoffice/merges","archive_url":"https://api.github.com/repos/hasgeek/boxoffice/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hasgeek/boxoffice/downloads","issues_url":"https://api.github.com/repos/hasgeek/boxoffice/issues{/number}","pulls_url":"https://api.github.com/repos/hasgeek/boxoffice/pulls{/number}","milestones_url":"https://api.github.com/repos/hasgeek/boxoffice/milestones{/number}","notifications_url":"https://api.github.com/repos/hasgeek/boxoffice/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hasgeek/boxoffice/labels{/name}","releases_url":"https://api.github.com/repos/hasgeek/boxoffice/releases{/id}","deployments_url":"https://api.github.com/repos/hasgeek/boxoffice/deployments","created_at":"2012-01-16T05:47:45Z","updated_at":"2016-10-28T15:08:00Z","pushed_at":"2017-02-08T14:43:19Z","git_url":"git://github.com/hasgeek/boxoffice.git","ssh_url":"git@github.com:hasgeek/boxoffice.git","clone_url":"https://github.com/hasgeek/boxoffice.git","svn_url":"https://github.com/hasgeek/boxoffice","homepage":"","size":19542,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":46,"forks":2,"open_issues":46,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hasgeek/boxoffice/pulls/110"},"html":{"href":"https://github.com/hasgeek/boxoffice/pull/110"},"issue":{"href":"https://api.github.com/repos/hasgeek/boxoffice/issues/110"},"comments":{"href":"https://api.github.com/repos/hasgeek/boxoffice/issues/110/comments"},"review_comments":{"href":"https://api.github.com/repos/hasgeek/boxoffice/pulls/110/comments"},"review_comment":{"href":"https://api.github.com/repos/hasgeek/boxoffice/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hasgeek/boxoffice/pulls/110/commits"},"statuses":{"href":"https://api.github.com/repos/hasgeek/boxoffice/statuses/f035fac18af1378540a549aa0f1cf402442f46b9"}}}}
{"actor":{"display_login":"shreyas-satish"}}