GitHub PullRequestReviewCommentEvent at 2014-10-20 01:56:34
Repository: pyfarm-master
Actor: opalmer
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/pyfarm/pyfarm-master/pulls/comments/19065934","id":19065934,"diff_hunk":"@@ -86,25 +86,25 @@ def jobs():\n     order_by = \"title\"\n     if \"order_by\" in request.args:\n         order_by = request.args.get(\"order_by\")\n-        if order_by not in [\"title\", \"state\", \"time_submitted\", \"t_queued\",\n-                            \"t_running\", \"t_failed\", \"t_done\"]:\n+    if order_by not in [\"title\", \"state\", \"time_submitted\", \"t_queued\",\n+                        \"t_running\", \"t_failed\", \"t_done\"]:\n+        return (render_template(\n+            \"pyfarm/error.html\", error=\"unknown order key\"), BAD_REQUEST)\n+    if \"order_dir\" in request.args:\n+        order_dir = request.args.get(\"order_dir\")\n+        if order_dir not in [\"asc\", \"desc\"]:\n             return (render_template(\n-                \"pyfarm/error.html\", error=\"unknown order key\"), BAD_REQUEST)\n-        if \"order_dir\" in request.args:\n-            order_dir = request.args.get(\"order_dir\")\n-            if order_dir not in [\"asc\", \"desc\"]:\n-                return (render_template(\n-                \"pyfarm/error.html\", error=\"unknown order dir\"), BAD_REQUEST)\n-        if order_by == \"time_submitted\" and order_dir == \"desc\":\n-            jobs_query = jobs_query.order_by(desc(a_job.time_submitted))\n-        elif order_by == \"time_submitted\" and order_dir == \"asc\":\n-            jobs_query = jobs_query.order_by(asc(a_job.time_submitted))\n-        elif order_by == \"state\" and order_dir == \"desc\":\n-            jobs_query = jobs_query.order_by(desc(a_job.state))\n-        elif order_by == \"state\" and order_dir == \"asc\":\n-            jobs_query = jobs_query.order_by(asc(a_job.state))\n-        else:\n-            jobs_query = jobs_query.order_by(\"%s %s\" % (order_by, order_dir))\n+            \"pyfarm/error.html\", error=\"unknown order dir\"), BAD_REQUEST)\n+    if order_by == \"time_submitted\" and order_dir == \"desc\":\n+        jobs_query = jobs_query.order_by(desc(a_job.time_submitted))\n+    elif order_by == \"time_submitted\" and order_dir == \"asc\":\n+        jobs_query = jobs_query.order_by(asc(a_job.time_submitted))\n+    elif order_by == \"state\" and order_dir == \"desc\":\n+        jobs_query = jobs_query.order_by(desc(a_job.state))\n+    elif order_by == \"state\" and order_dir == \"asc\":\n+        jobs_query = jobs_query.order_by(asc(a_job.state))\n+    else:\n+        jobs_query = jobs_query.order_by(\"%s %s\" % (order_by, order_dir))","path":"pyfarm/master/user_interface/jobs.py","position":40,"original_position":40,"commit_id":"e45fa05875a20e1ffd2dfa1aea4f1890cda0676f","original_commit_id":"e45fa05875a20e1ffd2dfa1aea4f1890cda0676f","user":{"login":"opalmer","id":255117,"avatar_url":"https://avatars.githubusercontent.com/u/255117?v=2","gravatar_id":"","url":"https://api.github.com/users/opalmer","html_url":"https://github.com/opalmer","followers_url":"https://api.github.com/users/opalmer/followers","following_url":"https://api.github.com/users/opalmer/following{/other_user}","gists_url":"https://api.github.com/users/opalmer/gists{/gist_id}","starred_url":"https://api.github.com/users/opalmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opalmer/subscriptions","organizations_url":"https://api.github.com/users/opalmer/orgs","repos_url":"https://api.github.com/users/opalmer/repos","events_url":"https://api.github.com/users/opalmer/events{/privacy}","received_events_url":"https://api.github.com/users/opalmer/received_events","type":"User","site_admin":false},"body":"I'd rather not trust user input and just return an error if it's something we don't understand.","created_at":"2014-10-20T01:56:34Z","updated_at":"2014-10-20T01:56:34Z","html_url":"https://github.com/pyfarm/pyfarm-master/pull/219#discussion_r19065934","pull_request_url":"https://api.github.com/repos/pyfarm/pyfarm-master/pulls/219","_links":{"self":{"href":"https://api.github.com/repos/pyfarm/pyfarm-master/pulls/comments/19065934"},"html":{"href":"https://github.com/pyfarm/pyfarm-master/pull/219#discussion_r19065934"},"pull_request":{"href":"https://api.github.com/repos/pyfarm/pyfarm-master/pulls/219"}}},"pull_request":{"url":"https://api.github.com/repos/pyfarm/pyfarm-master/pulls/219","id":22846077,"html_url":"https://github.com/pyfarm/pyfarm-master/pull/219","diff_url":"https://github.com/pyfarm/pyfarm-master/pull/219.diff","patch_url":"https://github.com/pyfarm/pyfarm-master/pull/219.patch","issue_url":"https://api.github.com/repos/pyfarm/pyfarm-master/issues/219","number":219,"state":"open","locked":false,"title":"Fix the default sorting for jobs","user":{"login":"guidow","id":6033185,"avatar_url":"https://avatars.githubusercontent.com/u/6033185?v=2","gravatar_id":"","url":"https://api.github.com/users/guidow","html_url":"https://github.com/guidow","followers_url":"https://api.github.com/users/guidow/followers","following_url":"https://api.github.com/users/guidow/following{/other_user}","gists_url":"https://api.github.com/users/guidow/gists{/gist_id}","starred_url":"https://api.github.com/users/guidow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guidow/subscriptions","organizations_url":"https://api.github.com/users/guidow/orgs","repos_url":"https://api.github.com/users/guidow/repos","events_url":"https://api.github.com/users/guidow/events{/privacy}","received_events_url":"https://api.github.com/users/guidow/received_events","type":"User","site_admin":false},"body":"The UI would indicate a default sort by title when visiting the jobs\r\npage.  This sort did not actually work, though, because sort was only\r\napplied when an explicit order_by argument was given on the url.","created_at":"2014-10-16T10:42:28Z","updated_at":"2014-10-20T01:56:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6f34307ce0e70f93dfaa98e189dc14b5ef334d99","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pyfarm/pyfarm-master/pulls/219/commits","review_comments_url":"https://api.github.com/repos/pyfarm/pyfarm-master/pulls/219/comments","review_comment_url":"https://api.github.com/repos/pyfarm/pyfarm-master/pulls/comments/{number}","comments_url":"https://api.github.com/repos/pyfarm/pyfarm-master/issues/219/comments","statuses_url":"https://api.github.com/repos/pyfarm/pyfarm-master/statuses/e45fa05875a20e1ffd2dfa1aea4f1890cda0676f","head":{"label":"guidow:fix_default_job_sort","ref":"fix_default_job_sort","sha":"e45fa05875a20e1ffd2dfa1aea4f1890cda0676f","user":{"login":"guidow","id":6033185,"avatar_url":"https://avatars.githubusercontent.com/u/6033185?v=2","gravatar_id":"","url":"https://api.github.com/users/guidow","html_url":"https://github.com/guidow","followers_url":"https://api.github.com/users/guidow/followers","following_url":"https://api.github.com/users/guidow/following{/other_user}","gists_url":"https://api.github.com/users/guidow/gists{/gist_id}","starred_url":"https://api.github.com/users/guidow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guidow/subscriptions","organizations_url":"https://api.github.com/users/guidow/orgs","repos_url":"https://api.github.com/users/guidow/repos","events_url":"https://api.github.com/users/guidow/events{/privacy}","received_events_url":"https://api.github.com/users/guidow/received_events","type":"User","site_admin":false},"repo":{"id":14693153,"name":"pyfarm-master","full_name":"guidow/pyfarm-master","owner":{"login":"guidow","id":6033185,"avatar_url":"https://avatars.githubusercontent.com/u/6033185?v=2","gravatar_id":"","url":"https://api.github.com/users/guidow","html_url":"https://github.com/guidow","followers_url":"https://api.github.com/users/guidow/followers","following_url":"https://api.github.com/users/guidow/following{/other_user}","gists_url":"https://api.github.com/users/guidow/gists{/gist_id}","starred_url":"https://api.github.com/users/guidow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guidow/subscriptions","organizations_url":"https://api.github.com/users/guidow/orgs","repos_url":"https://api.github.com/users/guidow/repos","events_url":"https://api.github.com/users/guidow/events{/privacy}","received_events_url":"https://api.github.com/users/guidow/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/guidow/pyfarm-master","description":"Sub-library which contains the code necessary to communicate with the database via a REST api.","fork":true,"url":"https://api.github.com/repos/guidow/pyfarm-master","forks_url":"https://api.github.com/repos/guidow/pyfarm-master/forks","keys_url":"https://api.github.com/repos/guidow/pyfarm-master/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guidow/pyfarm-master/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guidow/pyfarm-master/teams","hooks_url":"https://api.github.com/repos/guidow/pyfarm-master/hooks","issue_events_url":"https://api.github.com/repos/guidow/pyfarm-master/issues/events{/number}","events_url":"https://api.github.com/repos/guidow/pyfarm-master/events","assignees_url":"https://api.github.com/repos/guidow/pyfarm-master/assignees{/user}","branches_url":"https://api.github.com/repos/guidow/pyfarm-master/branches{/branch}","tags_url":"https://api.github.com/repos/guidow/pyfarm-master/tags","blobs_url":"https://api.github.com/repos/guidow/pyfarm-master/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guidow/pyfarm-master/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guidow/pyfarm-master/git/refs{/sha}","trees_url":"https://api.github.com/repos/guidow/pyfarm-master/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guidow/pyfarm-master/statuses/{sha}","languages_url":"https://api.github.com/repos/guidow/pyfarm-master/languages","stargazers_url":"https://api.github.com/repos/guidow/pyfarm-master/stargazers","contributors_url":"https://api.github.com/repos/guidow/pyfarm-master/contributors","subscribers_url":"https://api.github.com/repos/guidow/pyfarm-master/subscribers","subscription_url":"https://api.github.com/repos/guidow/pyfarm-master/subscription","commits_url":"https://api.github.com/repos/guidow/pyfarm-master/commits{/sha}","git_commits_url":"https://api.github.com/repos/guidow/pyfarm-master/git/commits{/sha}","comments_url":"https://api.github.com/repos/guidow/pyfarm-master/comments{/number}","issue_comment_url":"https://api.github.com/repos/guidow/pyfarm-master/issues/comments/{number}","contents_url":"https://api.github.com/repos/guidow/pyfarm-master/contents/{+path}","compare_url":"https://api.github.com/repos/guidow/pyfarm-master/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guidow/pyfarm-master/merges","archive_url":"https://api.github.com/repos/guidow/pyfarm-master/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guidow/pyfarm-master/downloads","issues_url":"https://api.github.com/repos/guidow/pyfarm-master/issues{/number}","pulls_url":"https://api.github.com/repos/guidow/pyfarm-master/pulls{/number}","milestones_url":"https://api.github.com/repos/guidow/pyfarm-master/milestones{/number}","notifications_url":"https://api.github.com/repos/guidow/pyfarm-master/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guidow/pyfarm-master/labels{/name}","releases_url":"https://api.github.com/repos/guidow/pyfarm-master/releases{/id}","created_at":"2013-11-25T17:41:52Z","updated_at":"2014-07-16T13:52:25Z","pushed_at":"2014-10-17T14:09:58Z","git_url":"git://github.com/guidow/pyfarm-master.git","ssh_url":"git@github.com:guidow/pyfarm-master.git","clone_url":"https://github.com/guidow/pyfarm-master.git","svn_url":"https://github.com/guidow/pyfarm-master","homepage":null,"size":4508,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"pyfarm:master","ref":"master","sha":"02aa96d3185e7c1f6e51be0bd90787b95b7a6765","user":{"login":"pyfarm","id":5248007,"avatar_url":"https://avatars.githubusercontent.com/u/5248007?v=2","gravatar_id":"","url":"https://api.github.com/users/pyfarm","html_url":"https://github.com/pyfarm","followers_url":"https://api.github.com/users/pyfarm/followers","following_url":"https://api.github.com/users/pyfarm/following{/other_user}","gists_url":"https://api.github.com/users/pyfarm/gists{/gist_id}","starred_url":"https://api.github.com/users/pyfarm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyfarm/subscriptions","organizations_url":"https://api.github.com/users/pyfarm/orgs","repos_url":"https://api.github.com/users/pyfarm/repos","events_url":"https://api.github.com/users/pyfarm/events{/privacy}","received_events_url":"https://api.github.com/users/pyfarm/received_events","type":"Organization","site_admin":false},"repo":{"id":12912885,"name":"pyfarm-master","full_name":"pyfarm/pyfarm-master","owner":{"login":"pyfarm","id":5248007,"avatar_url":"https://avatars.githubusercontent.com/u/5248007?v=2","gravatar_id":"","url":"https://api.github.com/users/pyfarm","html_url":"https://github.com/pyfarm","followers_url":"https://api.github.com/users/pyfarm/followers","following_url":"https://api.github.com/users/pyfarm/following{/other_user}","gists_url":"https://api.github.com/users/pyfarm/gists{/gist_id}","starred_url":"https://api.github.com/users/pyfarm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyfarm/subscriptions","organizations_url":"https://api.github.com/users/pyfarm/orgs","repos_url":"https://api.github.com/users/pyfarm/repos","events_url":"https://api.github.com/users/pyfarm/events{/privacy}","received_events_url":"https://api.github.com/users/pyfarm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pyfarm/pyfarm-master","description":"Sub-library which contains the code necessary to communicate with the database via a REST api.","fork":false,"url":"https://api.github.com/repos/pyfarm/pyfarm-master","forks_url":"https://api.github.com/repos/pyfarm/pyfarm-master/forks","keys_url":"https://api.github.com/repos/pyfarm/pyfarm-master/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pyfarm/pyfarm-master/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pyfarm/pyfarm-master/teams","hooks_url":"https://api.github.com/repos/pyfarm/pyfarm-master/hooks","issue_events_url":"https://api.github.com/repos/pyfarm/pyfarm-master/issues/events{/number}","events_url":"https://api.github.com/repos/pyfarm/pyfarm-master/events","assignees_url":"https://api.github.com/repos/pyfarm/pyfarm-master/assignees{/user}","branches_url":"https://api.github.com/repos/pyfarm/pyfarm-master/branches{/branch}","tags_url":"https://api.github.com/repos/pyfarm/pyfarm-master/tags","blobs_url":"https://api.github.com/repos/pyfarm/pyfarm-master/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pyfarm/pyfarm-master/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pyfarm/pyfarm-master/git/refs{/sha}","trees_url":"https://api.github.com/repos/pyfarm/pyfarm-master/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pyfarm/pyfarm-master/statuses/{sha}","languages_url":"https://api.github.com/repos/pyfarm/pyfarm-master/languages","stargazers_url":"https://api.github.com/repos/pyfarm/pyfarm-master/stargazers","contributors_url":"https://api.github.com/repos/pyfarm/pyfarm-master/contributors","subscribers_url":"https://api.github.com/repos/pyfarm/pyfarm-master/subscribers","subscription_url":"https://api.github.com/repos/pyfarm/pyfarm-master/subscription","commits_url":"https://api.github.com/repos/pyfarm/pyfarm-master/commits{/sha}","git_commits_url":"https://api.github.com/repos/pyfarm/pyfarm-master/git/commits{/sha}","comments_url":"https://api.github.com/repos/pyfarm/pyfarm-master/comments{/number}","issue_comment_url":"https://api.github.com/repos/pyfarm/pyfarm-master/issues/comments/{number}","contents_url":"https://api.github.com/repos/pyfarm/pyfarm-master/contents/{+path}","compare_url":"https://api.github.com/repos/pyfarm/pyfarm-master/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pyfarm/pyfarm-master/merges","archive_url":"https://api.github.com/repos/pyfarm/pyfarm-master/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pyfarm/pyfarm-master/downloads","issues_url":"https://api.github.com/repos/pyfarm/pyfarm-master/issues{/number}","pulls_url":"https://api.github.com/repos/pyfarm/pyfarm-master/pulls{/number}","milestones_url":"https://api.github.com/repos/pyfarm/pyfarm-master/milestones{/number}","notifications_url":"https://api.github.com/repos/pyfarm/pyfarm-master/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pyfarm/pyfarm-master/labels{/name}","releases_url":"https://api.github.com/repos/pyfarm/pyfarm-master/releases{/id}","created_at":"2013-09-18T03:10:36Z","updated_at":"2014-09-02T04:38:19Z","pushed_at":"2014-10-16T10:37:55Z","git_url":"git://github.com/pyfarm/pyfarm-master.git","ssh_url":"git@github.com:pyfarm/pyfarm-master.git","clone_url":"https://github.com/pyfarm/pyfarm-master.git","svn_url":"https://github.com/pyfarm/pyfarm-master","homepage":null,"size":6068,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":40,"forks":1,"open_issues":40,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pyfarm/pyfarm-master/pulls/219"},"html":{"href":"https://github.com/pyfarm/pyfarm-master/pull/219"},"issue":{"href":"https://api.github.com/repos/pyfarm/pyfarm-master/issues/219"},"comments":{"href":"https://api.github.com/repos/pyfarm/pyfarm-master/issues/219/comments"},"review_comments":{"href":"https://api.github.com/repos/pyfarm/pyfarm-master/pulls/219/comments"},"review_comment":{"href":"https://api.github.com/repos/pyfarm/pyfarm-master/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/pyfarm/pyfarm-master/pulls/219/commits"},"statuses":{"href":"https://api.github.com/repos/pyfarm/pyfarm-master/statuses/e45fa05875a20e1ffd2dfa1aea4f1890cda0676f"}}}}