{"action":"created","comment":{"url":"https://api.github.com/repos/django/django/pulls/comments/76786049","id":76786049,"diff_hunk":"@@ -50,6 +50,9 @@ def __init__(self, content_type=None, status=None, reason=None, charset=None):\n         self.cookies = SimpleCookie()\n         self.closed = False\n         if status is not None:\n+            if not isinstance(status, int) or status < 100 or status > 599:\n+                raise ValueError('invalid HTTP status code: \"{status}\"'.format(","path":"django/http/response.py","position":5,"original_position":5,"commit_id":"a24811d61729ed7509f16380e5675dbb8a1faa97","original_commit_id":"a24811d61729ed7509f16380e5675dbb8a1faa97","user":{"login":"timgraham","id":411869,"avatar_url":"https://avatars.githubusercontent.com/u/411869?v=3","gravatar_id":"","url":"https://api.github.com/users/timgraham","html_url":"https://github.com/timgraham","followers_url":"https://api.github.com/users/timgraham/followers","following_url":"https://api.github.com/users/timgraham/following{/other_user}","gists_url":"https://api.github.com/users/timgraham/gists{/gist_id}","starred_url":"https://api.github.com/users/timgraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timgraham/subscriptions","organizations_url":"https://api.github.com/users/timgraham/orgs","repos_url":"https://api.github.com/users/timgraham/repos","events_url":"https://api.github.com/users/timgraham/events{/privacy}","received_events_url":"https://api.github.com/users/timgraham/received_events","type":"User","site_admin":false},"body":"You could use `{!r}` so that `repr()` is called to include the quotes on strings.","created_at":"2016-08-30T12:39:23Z","updated_at":"2016-08-30T12:39:23Z","html_url":"https://github.com/django/django/pull/7165#discussion_r76786049","pull_request_url":"https://api.github.com/repos/django/django/pulls/7165","_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/comments/76786049"},"html":{"href":"https://github.com/django/django/pull/7165#discussion_r76786049"},"pull_request":{"href":"https://api.github.com/repos/django/django/pulls/7165"}}},"pull_request":{"url":"https://api.github.com/repos/django/django/pulls/7165","id":83002409,"html_url":"https://github.com/django/django/pull/7165","diff_url":"https://github.com/django/django/pull/7165.diff","patch_url":"https://github.com/django/django/pull/7165.patch","issue_url":"https://api.github.com/repos/django/django/issues/7165","number":7165,"state":"open","locked":false,"title":"raise ValueError for invalid HttpResponse status","user":{"login":"ryangallen","id":1379681,"avatar_url":"https://avatars.githubusercontent.com/u/1379681?v=3","gravatar_id":"","url":"https://api.github.com/users/ryangallen","html_url":"https://github.com/ryangallen","followers_url":"https://api.github.com/users/ryangallen/followers","following_url":"https://api.github.com/users/ryangallen/following{/other_user}","gists_url":"https://api.github.com/users/ryangallen/gists{/gist_id}","starred_url":"https://api.github.com/users/ryangallen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryangallen/subscriptions","organizations_url":"https://api.github.com/users/ryangallen/orgs","repos_url":"https://api.github.com/users/ryangallen/repos","events_url":"https://api.github.com/users/ryangallen/events{/privacy}","received_events_url":"https://api.github.com/users/ryangallen/received_events","type":"User","site_admin":false},"body":"I was accidentally passing a string for the status to DRF's `Response` class ([it inherits from Django's SimpleTemplateResponse](https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/response.py#L16)) and getting:\r\n\r\n```\r\n  File \"[...]/django/http/utils.py\", line 17, in conditional_content_removal\r\n    if 100 <= response.status_code < 200 or response.status_code in (204, 304):\r\nTypeError: unorderable types: int() <= str()\r\n```\r\n\r\nThinking the bad value shouldn't get that far so this PR checks the value in the `HttpResponseBase` class.","created_at":"2016-08-28T00:33:21Z","updated_at":"2016-08-30T12:39:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bef30b78886d8664b32ee2a26cad8d485a5ebc6b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/django/django/pulls/7165/commits","review_comments_url":"https://api.github.com/repos/django/django/pulls/7165/comments","review_comment_url":"https://api.github.com/repos/django/django/pulls/comments{/number}","comments_url":"https://api.github.com/repos/django/django/issues/7165/comments","statuses_url":"https://api.github.com/repos/django/django/statuses/a24811d61729ed7509f16380e5675dbb8a1faa97","head":{"label":"ryangallen:http_status","ref":"http_status","sha":"a24811d61729ed7509f16380e5675dbb8a1faa97","user":{"login":"ryangallen","id":1379681,"avatar_url":"https://avatars.githubusercontent.com/u/1379681?v=3","gravatar_id":"","url":"https://api.github.com/users/ryangallen","html_url":"https://github.com/ryangallen","followers_url":"https://api.github.com/users/ryangallen/followers","following_url":"https://api.github.com/users/ryangallen/following{/other_user}","gists_url":"https://api.github.com/users/ryangallen/gists{/gist_id}","starred_url":"https://api.github.com/users/ryangallen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryangallen/subscriptions","organizations_url":"https://api.github.com/users/ryangallen/orgs","repos_url":"https://api.github.com/users/ryangallen/repos","events_url":"https://api.github.com/users/ryangallen/events{/privacy}","received_events_url":"https://api.github.com/users/ryangallen/received_events","type":"User","site_admin":false},"repo":{"id":13315394,"name":"django","full_name":"ryangallen/django","owner":{"login":"ryangallen","id":1379681,"avatar_url":"https://avatars.githubusercontent.com/u/1379681?v=3","gravatar_id":"","url":"https://api.github.com/users/ryangallen","html_url":"https://github.com/ryangallen","followers_url":"https://api.github.com/users/ryangallen/followers","following_url":"https://api.github.com/users/ryangallen/following{/other_user}","gists_url":"https://api.github.com/users/ryangallen/gists{/gist_id}","starred_url":"https://api.github.com/users/ryangallen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryangallen/subscriptions","organizations_url":"https://api.github.com/users/ryangallen/orgs","repos_url":"https://api.github.com/users/ryangallen/repos","events_url":"https://api.github.com/users/ryangallen/events{/privacy}","received_events_url":"https://api.github.com/users/ryangallen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ryangallen/django","description":"The Web framework for perfectionists with deadlines.","fork":true,"url":"https://api.github.com/repos/ryangallen/django","forks_url":"https://api.github.com/repos/ryangallen/django/forks","keys_url":"https://api.github.com/repos/ryangallen/django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ryangallen/django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ryangallen/django/teams","hooks_url":"https://api.github.com/repos/ryangallen/django/hooks","issue_events_url":"https://api.github.com/repos/ryangallen/django/issues/events{/number}","events_url":"https://api.github.com/repos/ryangallen/django/events","assignees_url":"https://api.github.com/repos/ryangallen/django/assignees{/user}","branches_url":"https://api.github.com/repos/ryangallen/django/branches{/branch}","tags_url":"https://api.github.com/repos/ryangallen/django/tags","blobs_url":"https://api.github.com/repos/ryangallen/django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ryangallen/django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ryangallen/django/git/refs{/sha}","trees_url":"https://api.github.com/repos/ryangallen/django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ryangallen/django/statuses/{sha}","languages_url":"https://api.github.com/repos/ryangallen/django/languages","stargazers_url":"https://api.github.com/repos/ryangallen/django/stargazers","contributors_url":"https://api.github.com/repos/ryangallen/django/contributors","subscribers_url":"https://api.github.com/repos/ryangallen/django/subscribers","subscription_url":"https://api.github.com/repos/ryangallen/django/subscription","commits_url":"https://api.github.com/repos/ryangallen/django/commits{/sha}","git_commits_url":"https://api.github.com/repos/ryangallen/django/git/commits{/sha}","comments_url":"https://api.github.com/repos/ryangallen/django/comments{/number}","issue_comment_url":"https://api.github.com/repos/ryangallen/django/issues/comments{/number}","contents_url":"https://api.github.com/repos/ryangallen/django/contents/{+path}","compare_url":"https://api.github.com/repos/ryangallen/django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ryangallen/django/merges","archive_url":"https://api.github.com/repos/ryangallen/django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ryangallen/django/downloads","issues_url":"https://api.github.com/repos/ryangallen/django/issues{/number}","pulls_url":"https://api.github.com/repos/ryangallen/django/pulls{/number}","milestones_url":"https://api.github.com/repos/ryangallen/django/milestones{/number}","notifications_url":"https://api.github.com/repos/ryangallen/django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ryangallen/django/labels{/name}","releases_url":"https://api.github.com/repos/ryangallen/django/releases{/id}","deployments_url":"https://api.github.com/repos/ryangallen/django/deployments","created_at":"2013-10-04T03:04:15Z","updated_at":"2015-03-10T00:44:59Z","pushed_at":"2016-08-28T00:54:03Z","git_url":"git://github.com/ryangallen/django.git","ssh_url":"git@github.com:ryangallen/django.git","clone_url":"https://github.com/ryangallen/django.git","svn_url":"https://github.com/ryangallen/django","homepage":"http://www.djangoproject.com/","size":121454,"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":"django:master","ref":"master","sha":"38cf9ef390eb0cd0703d99893f826153865f6ba6","user":{"login":"django","id":27804,"avatar_url":"https://avatars.githubusercontent.com/u/27804?v=3","gravatar_id":"","url":"https://api.github.com/users/django","html_url":"https://github.com/django","followers_url":"https://api.github.com/users/django/followers","following_url":"https://api.github.com/users/django/following{/other_user}","gists_url":"https://api.github.com/users/django/gists{/gist_id}","starred_url":"https://api.github.com/users/django/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/django/subscriptions","organizations_url":"https://api.github.com/users/django/orgs","repos_url":"https://api.github.com/users/django/repos","events_url":"https://api.github.com/users/django/events{/privacy}","received_events_url":"https://api.github.com/users/django/received_events","type":"Organization","site_admin":false},"repo":{"id":4164482,"name":"django","full_name":"django/django","owner":{"login":"django","id":27804,"avatar_url":"https://avatars.githubusercontent.com/u/27804?v=3","gravatar_id":"","url":"https://api.github.com/users/django","html_url":"https://github.com/django","followers_url":"https://api.github.com/users/django/followers","following_url":"https://api.github.com/users/django/following{/other_user}","gists_url":"https://api.github.com/users/django/gists{/gist_id}","starred_url":"https://api.github.com/users/django/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/django/subscriptions","organizations_url":"https://api.github.com/users/django/orgs","repos_url":"https://api.github.com/users/django/repos","events_url":"https://api.github.com/users/django/events{/privacy}","received_events_url":"https://api.github.com/users/django/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/django/django","description":"The Web framework for perfectionists with deadlines.","fork":false,"url":"https://api.github.com/repos/django/django","forks_url":"https://api.github.com/repos/django/django/forks","keys_url":"https://api.github.com/repos/django/django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/django/django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/django/django/teams","hooks_url":"https://api.github.com/repos/django/django/hooks","issue_events_url":"https://api.github.com/repos/django/django/issues/events{/number}","events_url":"https://api.github.com/repos/django/django/events","assignees_url":"https://api.github.com/repos/django/django/assignees{/user}","branches_url":"https://api.github.com/repos/django/django/branches{/branch}","tags_url":"https://api.github.com/repos/django/django/tags","blobs_url":"https://api.github.com/repos/django/django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/django/django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/django/django/git/refs{/sha}","trees_url":"https://api.github.com/repos/django/django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/django/django/statuses/{sha}","languages_url":"https://api.github.com/repos/django/django/languages","stargazers_url":"https://api.github.com/repos/django/django/stargazers","contributors_url":"https://api.github.com/repos/django/django/contributors","subscribers_url":"https://api.github.com/repos/django/django/subscribers","subscription_url":"https://api.github.com/repos/django/django/subscription","commits_url":"https://api.github.com/repos/django/django/commits{/sha}","git_commits_url":"https://api.github.com/repos/django/django/git/commits{/sha}","comments_url":"https://api.github.com/repos/django/django/comments{/number}","issue_comment_url":"https://api.github.com/repos/django/django/issues/comments{/number}","contents_url":"https://api.github.com/repos/django/django/contents/{+path}","compare_url":"https://api.github.com/repos/django/django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/django/django/merges","archive_url":"https://api.github.com/repos/django/django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/django/django/downloads","issues_url":"https://api.github.com/repos/django/django/issues{/number}","pulls_url":"https://api.github.com/repos/django/django/pulls{/number}","milestones_url":"https://api.github.com/repos/django/django/milestones{/number}","notifications_url":"https://api.github.com/repos/django/django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/django/django/labels{/name}","releases_url":"https://api.github.com/repos/django/django/releases{/id}","deployments_url":"https://api.github.com/repos/django/django/deployments","created_at":"2012-04-28T02:47:18Z","updated_at":"2016-08-30T12:02:44Z","pushed_at":"2016-08-30T10:15:10Z","git_url":"git://github.com/django/django.git","ssh_url":"git@github.com:django/django.git","clone_url":"https://github.com/django/django.git","svn_url":"https://github.com/django/django","homepage":"https://www.djangoproject.com/","size":197414,"stargazers_count":20980,"watchers_count":20980,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8463,"mirror_url":null,"open_issues_count":106,"forks":8463,"open_issues":106,"watchers":20980,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/7165"},"html":{"href":"https://github.com/django/django/pull/7165"},"issue":{"href":"https://api.github.com/repos/django/django/issues/7165"},"comments":{"href":"https://api.github.com/repos/django/django/issues/7165/comments"},"review_comments":{"href":"https://api.github.com/repos/django/django/pulls/7165/comments"},"review_comment":{"href":"https://api.github.com/repos/django/django/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/django/django/pulls/7165/commits"},"statuses":{"href":"https://api.github.com/repos/django/django/statuses/a24811d61729ed7509f16380e5675dbb8a1faa97"}}}}
{"actor":{"display_login":"timgraham"}}