)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"02fc30d6b3e8d7a193c5154881c4d339a1d285af","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Don\u0027t force CONTENT_LENGTH to be an int()"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"The CONTENT_LENGTH Header can be present, but empty, which returns None,"},{"line_number":10,"context_line":"and causes a ValueError when attempting to use .int()."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"This patch removes the setting of CONTENT_LENGTH to an integer, since it"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"bff0334d_dccda5b7","line":9,"updated":"2017-04-11 14:24:20.000000000","message":"It\u0027s not that the header is present but empty, it is that the environ key is present but empty, presumably a side effect of uwsgi_params.\n\nThis is a mildly important distinction because neither header mentioned here is allowed to be present but empty.","commit_id":"7845491b45bb4d7f8b7d912e1abd9d7a10745573"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"e9b056df5a7ba7f3f5b0618097da87d7295847ef","unresolved":false,"context_lines":[{"line_number":10,"context_line":"and causes a ValueError when attempting to use .int()."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"This patch removes the setting of CONTENT_LENGTH to an integer, since it"},{"line_number":13,"context_line":"doesn\u0027t need to be an int, and on integer comparisons are performed"},{"line_number":14,"context_line":"afterwards."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Additionally, as the CONTENT_TYPE header can similarly be present but"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"bff0334d_7175a2f9","line":13,"range":{"start_line":13,"start_character":31,"end_line":13,"end_character":57},"updated":"2017-04-11 14:05:18.000000000","message":"This doesn\u0027t parse","commit_id":"7845491b45bb4d7f8b7d912e1abd9d7a10745573"}],"nova/api/openstack/placement/handler.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"e9b056df5a7ba7f3f5b0618097da87d7295847ef","unresolved":false,"context_lines":[{"line_number":179,"context_line":"                    json_formatter\u003dutil.json_error_formatter)"},{"line_number":180,"context_line":"        # Check that an incoming request with a content-length"},{"line_number":181,"context_line":"        # header also has a content-type header. If not raise a 400."},{"line_number":182,"context_line":"        if environ.get(\u0027CONTENT_LENGTH\u0027, 0):"},{"line_number":183,"context_line":"            if not environ.get(\u0027CONTENT_TYPE\u0027, \u0027\u0027):"},{"line_number":184,"context_line":"                raise webob.exc.HTTPBadRequest("},{"line_number":185,"context_line":"                    _(\u0027content-type header required\u0027),"}],"source_content_type":"text/x-python","patch_set":2,"id":"bff0334d_f181b2c4","line":182,"updated":"2017-04-11 14:05:18.000000000","message":"This is okay, but no longer validates a totally bogus CONTENT_LENGTH (like \"foo\").  If the only non-int() special case we\u0027re concerned about is \u0027\u0027, perhaps:\n\n if int(environ.get(\u0027CONTENT_LENGTH\u0027, 0) or 0):\n\nOr maybe we want an explicit check:\n\n clen \u003d environ.get(\u0027CONTENT_LENGTH\u0027, 0) or 0\n try:\n     clen \u003d int(clen)\n except ValueError:\n     raise ...\n if clen:\n     if not ...\u0027CONTENT_TYPE\u0027...\n         ...","commit_id":"7845491b45bb4d7f8b7d912e1abd9d7a10745573"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"39f9e5f02805d70a1d085b883c94b4ef872098f1","unresolved":false,"context_lines":[{"line_number":181,"context_line":"        # header also has a content-type header. If not raise a 400."},{"line_number":182,"context_line":"        if (\u0027CONTENT_LENGTH\u0027 in environ and environ[\u0027CONTENT_LENGTH\u0027] and"},{"line_number":183,"context_line":"           int(environ.get(\u0027CONTENT_LENGTH\u0027, 0)) and"},{"line_number":184,"context_line":"           \u0027CONTENT_TYPE\u0027 not in environ):"},{"line_number":185,"context_line":"                raise webob.exc.HTTPBadRequest("},{"line_number":186,"context_line":"                    _(\u0027content-type header required\u0027),"},{"line_number":187,"context_line":"                    json_formatter\u003dutil.json_error_formatter)"}],"source_content_type":"text/x-python","patch_set":6,"id":"bff0334d_8a121361","line":184,"updated":"2017-04-12 09:11:21.000000000","message":"In the bug report it says:\n\n\"We\u0027re using Nginx /w uWSGI and I believe a default uwsgi param is set to always send a CONTENT_LENGTH and CONTENT_TYPE header even when those are empty.\"\n\nThe error in this code, for both CONTENT_LENGTH and CONTENT_TYPE is that it assumed that neither would be present if the header was not present. So, in order to fix that bad assumption we need to check that CONTENT_TYPE has a value, not just that it is present.\n\nOtherwise the original issue this block of code was designed to protect against -- bodies being present without a content-type value -- will not have protection in the nginx/uwsgi setting.","commit_id":"1073d901fda4e74b4e841e9f85838031c100f5f6"},{"author":{"_account_id":2799,"name":"Andy McCrae","email":"andy.mccrae@googlemail.com","username":"andrew-mccrae"},"change_message_id":"96ebdc332afd645965cf367a7bf802547ab2bbbe","unresolved":false,"context_lines":[{"line_number":181,"context_line":"        # header also has a content-type header. If not raise a 400."},{"line_number":182,"context_line":"        if (\u0027CONTENT_LENGTH\u0027 in environ and environ[\u0027CONTENT_LENGTH\u0027] and"},{"line_number":183,"context_line":"           int(environ.get(\u0027CONTENT_LENGTH\u0027, 0)) and"},{"line_number":184,"context_line":"           \u0027CONTENT_TYPE\u0027 not in environ):"},{"line_number":185,"context_line":"                raise webob.exc.HTTPBadRequest("},{"line_number":186,"context_line":"                    _(\u0027content-type header required\u0027),"},{"line_number":187,"context_line":"                    json_formatter\u003dutil.json_error_formatter)"}],"source_content_type":"text/x-python","patch_set":6,"id":"bff0334d_2e6c34cc","line":184,"in_reply_to":"bff0334d_8a121361","updated":"2017-04-12 11:50:01.000000000","message":"Yeah that was a bit of a mis-step. I was trying to figure out why the func tests were failing on the previous patchset, and didn\u0027t adjust the content_type bits.\n\nI think the new one works:\n\"is content_length there and not empty if so, is content_length an int, if so is content_type present and not empty\"\n\nThanks for the reviews so far! Hopefully this resolves it.","commit_id":"1073d901fda4e74b4e841e9f85838031c100f5f6"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"75d736dd234d3b3dbbbf99902fe5fb5ff1bbdbe4","unresolved":false,"context_lines":[{"line_number":177,"context_line":"                raise webob.exc.HTTPForbidden("},{"line_number":178,"context_line":"                    _(\u0027admin required\u0027),"},{"line_number":179,"context_line":"                    json_formatter\u003dutil.json_error_formatter)"},{"line_number":180,"context_line":"        # Check that an incoming request with a content-length"},{"line_number":181,"context_line":"        # header also has a content-type header. If not raise a 400."},{"line_number":182,"context_line":"        if (environ.get(\u0027CONTENT_LENGTH\u0027, \u0027\u0027) and"},{"line_number":183,"context_line":"           int(environ.get(\u0027CONTENT_LENGTH\u0027, 0)) and"}],"source_content_type":"text/x-python","patch_set":7,"id":"bff0334d_24b4537f","line":180,"range":{"start_line":180,"start_character":41,"end_line":180,"end_character":62},"updated":"2017-04-12 13:05:24.000000000","message":"nit: \"with a nonzero content-length... has a nonempty content-type...\"","commit_id":"3267c9c742b35100ac6b441f5690375d1b5faf41"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"75d736dd234d3b3dbbbf99902fe5fb5ff1bbdbe4","unresolved":false,"context_lines":[{"line_number":180,"context_line":"        # Check that an incoming request with a content-length"},{"line_number":181,"context_line":"        # header also has a content-type header. If not raise a 400."},{"line_number":182,"context_line":"        if (environ.get(\u0027CONTENT_LENGTH\u0027, \u0027\u0027) and"},{"line_number":183,"context_line":"           int(environ.get(\u0027CONTENT_LENGTH\u0027, 0)) and"},{"line_number":184,"context_line":"           not environ.get(\u0027CONTENT_TYPE\u0027, \u0027\u0027)):"},{"line_number":185,"context_line":"                raise webob.exc.HTTPBadRequest("},{"line_number":186,"context_line":"                    _(\u0027content-type header required\u0027),"}],"source_content_type":"text/x-python","patch_set":7,"id":"bff0334d_3f3e9cc0","line":183,"updated":"2017-04-12 13:05:24.000000000","message":"nit: two environ.get()s of the same thing could be combined (default of zero would work fine in the first one).  But super-meh, environ.get is cheap.","commit_id":"3267c9c742b35100ac6b441f5690375d1b5faf41"},{"author":{"_account_id":2799,"name":"Andy McCrae","email":"andy.mccrae@googlemail.com","username":"andrew-mccrae"},"change_message_id":"421450517e86e4a95da23bb93c4866968f9e054f","unresolved":false,"context_lines":[{"line_number":180,"context_line":"        # Check that an incoming request with a content-length"},{"line_number":181,"context_line":"        # header also has a content-type header. If not raise a 400."},{"line_number":182,"context_line":"        if (environ.get(\u0027CONTENT_LENGTH\u0027, \u0027\u0027) and"},{"line_number":183,"context_line":"           int(environ.get(\u0027CONTENT_LENGTH\u0027, 0)) and"},{"line_number":184,"context_line":"           not environ.get(\u0027CONTENT_TYPE\u0027, \u0027\u0027)):"},{"line_number":185,"context_line":"                raise webob.exc.HTTPBadRequest("},{"line_number":186,"context_line":"                    _(\u0027content-type header required\u0027),"}],"source_content_type":"text/x-python","patch_set":7,"id":"bff0334d_7a3f9286","line":183,"in_reply_to":"bff0334d_3f3e9cc0","updated":"2017-04-12 13:23:53.000000000","message":"I\u0027m a bit confused how I\u0027d do that - could you give an example?\n\nThe issue is that the first environ.get checks that it exists - the second bit checks it\u0027s an int. I\u0027m not sure how to combine those. If we int() on the first one it\u0027ll fail out if it\u0027s empty (which is what we\u0027re trying to fix). The second one ensures that if it\u0027s non-empty and exists it is an int.","commit_id":"3267c9c742b35100ac6b441f5690375d1b5faf41"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"960a86091c1f8dbad46a41a4385d5a5b4e21f884","unresolved":false,"context_lines":[{"line_number":180,"context_line":"        # Check that an incoming request with a content-length"},{"line_number":181,"context_line":"        # header also has a content-type header. If not raise a 400."},{"line_number":182,"context_line":"        if (environ.get(\u0027CONTENT_LENGTH\u0027, \u0027\u0027) and"},{"line_number":183,"context_line":"           int(environ.get(\u0027CONTENT_LENGTH\u0027, 0)) and"},{"line_number":184,"context_line":"           not environ.get(\u0027CONTENT_TYPE\u0027, \u0027\u0027)):"},{"line_number":185,"context_line":"                raise webob.exc.HTTPBadRequest("},{"line_number":186,"context_line":"                    _(\u0027content-type header required\u0027),"}],"source_content_type":"text/x-python","patch_set":7,"id":"bff0334d_1548572a","line":183,"in_reply_to":"bff0334d_7a3f9286","updated":"2017-04-12 13:50:18.000000000","message":"Via a local var:\n\n clen \u003d environ.get(\u0027CONTENT_LENGTH\u0027, 0) or 0\n if clen and int(clen) and not environ.get(\u0027CONTENT_TYPE\u0027, \u0027\u0027):\n      raise ...\n\nThis is logically equivalent to what you\u0027ve got (including raising ValueError if it\u0027s a nonempty non-int()able).\nBonus: the condition fits on one line ;-)\nBut this is totally not critical.","commit_id":"3267c9c742b35100ac6b441f5690375d1b5faf41"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"f6a80d8fa03ca94c3290ceb5636ed2c2a623198d","unresolved":false,"context_lines":[{"line_number":180,"context_line":"        # Check that an incoming request with a content-length header"},{"line_number":181,"context_line":"        # that is an integer \u003e 0 and not empty, also has a content-type"},{"line_number":182,"context_line":"        # header that is not empty. If not raise a 400."},{"line_number":183,"context_line":"        if (environ.get(\u0027CONTENT_LENGTH\u0027, \u0027\u0027) and"},{"line_number":184,"context_line":"           int(environ.get(\u0027CONTENT_LENGTH\u0027, 0)) and"},{"line_number":185,"context_line":"           not environ.get(\u0027CONTENT_TYPE\u0027, \u0027\u0027)):"},{"line_number":186,"context_line":"                raise webob.exc.HTTPBadRequest("}],"source_content_type":"text/x-python","patch_set":8,"id":"7ffa3b31_8198431b","line":183,"range":{"start_line":183,"start_character":40,"end_line":183,"end_character":44},"updated":"2017-04-18 14:32:48.000000000","message":"this is unnecessary","commit_id":"7a85b45b71eae5e4e48724dca4fb0538f60e06b5"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"f6a80d8fa03ca94c3290ceb5636ed2c2a623198d","unresolved":false,"context_lines":[{"line_number":181,"context_line":"        # that is an integer \u003e 0 and not empty, also has a content-type"},{"line_number":182,"context_line":"        # header that is not empty. If not raise a 400."},{"line_number":183,"context_line":"        if (environ.get(\u0027CONTENT_LENGTH\u0027, \u0027\u0027) and"},{"line_number":184,"context_line":"           int(environ.get(\u0027CONTENT_LENGTH\u0027, 0)) and"},{"line_number":185,"context_line":"           not environ.get(\u0027CONTENT_TYPE\u0027, \u0027\u0027)):"},{"line_number":186,"context_line":"                raise webob.exc.HTTPBadRequest("},{"line_number":187,"context_line":"                    _(\u0027content-type header required\u0027),"}],"source_content_type":"text/x-python","patch_set":8,"id":"7ffa3b31_0172f3e3","line":184,"range":{"start_line":184,"start_character":15,"end_line":184,"end_character":47},"updated":"2017-04-18 14:32:48.000000000","message":"this will always return something now, so the \u00270\u0027 is unncessary","commit_id":"7a85b45b71eae5e4e48724dca4fb0538f60e06b5"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"7e9fc60fe15a05874fcda1a15edc6f9cabc7aabe","unresolved":false,"context_lines":[{"line_number":181,"context_line":"        # that is an integer \u003e 0 and not empty, also has a content-type"},{"line_number":182,"context_line":"        # header that is not empty. If not raise a 400."},{"line_number":183,"context_line":"        if (environ.get(\u0027CONTENT_LENGTH\u0027, \u0027\u0027) and"},{"line_number":184,"context_line":"           int(environ.get(\u0027CONTENT_LENGTH\u0027, 0)) and"},{"line_number":185,"context_line":"           not environ.get(\u0027CONTENT_TYPE\u0027, \u0027\u0027)):"},{"line_number":186,"context_line":"                raise webob.exc.HTTPBadRequest("},{"line_number":187,"context_line":"                    _(\u0027content-type header required\u0027),"}],"source_content_type":"text/x-python","patch_set":8,"id":"7ffa3b31_e4e6f544","line":184,"in_reply_to":"7ffa3b31_0172f3e3","updated":"2017-04-18 14:39:10.000000000","message":"\"now\" in relation to what?","commit_id":"7a85b45b71eae5e4e48724dca4fb0538f60e06b5"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"5d0b913ddf20132d3360b9272ae3c3fbb5febc35","unresolved":false,"context_lines":[{"line_number":181,"context_line":"        # that is an integer \u003e 0 and not empty, also has a content-type"},{"line_number":182,"context_line":"        # header that is not empty. If not raise a 400."},{"line_number":183,"context_line":"        if (environ.get(\u0027CONTENT_LENGTH\u0027, \u0027\u0027) and"},{"line_number":184,"context_line":"           int(environ.get(\u0027CONTENT_LENGTH\u0027, 0)) and"},{"line_number":185,"context_line":"           not environ.get(\u0027CONTENT_TYPE\u0027, \u0027\u0027)):"},{"line_number":186,"context_line":"                raise webob.exc.HTTPBadRequest("},{"line_number":187,"context_line":"                    _(\u0027content-type header required\u0027),"}],"source_content_type":"text/x-python","patch_set":8,"id":"7ffa3b31_7a1de071","line":184,"in_reply_to":"7ffa3b31_e4e6f544","updated":"2017-04-18 15:41:07.000000000","message":"\u003e \"now\" in relation to what?\n\nin relation to l183 above. We won\u0027t get this far unless that returned something that evaluates to boolean True (i.e. not \u0027\u0027 or None)","commit_id":"7a85b45b71eae5e4e48724dca4fb0538f60e06b5"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"b72a19a5f074d78dee1409fb7859a6ee5b923634","unresolved":false,"context_lines":[{"line_number":181,"context_line":"        # that is an integer \u003e 0 and not empty, also has a content-type"},{"line_number":182,"context_line":"        # header that is not empty. If not raise a 400."},{"line_number":183,"context_line":"        if (environ.get(\u0027CONTENT_LENGTH\u0027, \u0027\u0027) and"},{"line_number":184,"context_line":"           int(environ.get(\u0027CONTENT_LENGTH\u0027, 0)) and"},{"line_number":185,"context_line":"           not environ.get(\u0027CONTENT_TYPE\u0027, \u0027\u0027)):"},{"line_number":186,"context_line":"                raise webob.exc.HTTPBadRequest("},{"line_number":187,"context_line":"                    _(\u0027content-type header required\u0027),"}],"source_content_type":"text/x-python","patch_set":8,"id":"7ffa3b31_1f224e53","line":184,"in_reply_to":"7ffa3b31_e4e6f544","updated":"2017-04-18 15:06:42.000000000","message":"@sfinucan - is something upstack always setting this variable?  Cause we can\u0027t be guaranteed it\u0027s set in the env.","commit_id":"7a85b45b71eae5e4e48724dca4fb0538f60e06b5"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"f6a80d8fa03ca94c3290ceb5636ed2c2a623198d","unresolved":false,"context_lines":[{"line_number":182,"context_line":"        # header that is not empty. If not raise a 400."},{"line_number":183,"context_line":"        if (environ.get(\u0027CONTENT_LENGTH\u0027, \u0027\u0027) and"},{"line_number":184,"context_line":"           int(environ.get(\u0027CONTENT_LENGTH\u0027, 0)) and"},{"line_number":185,"context_line":"           not environ.get(\u0027CONTENT_TYPE\u0027, \u0027\u0027)):"},{"line_number":186,"context_line":"                raise webob.exc.HTTPBadRequest("},{"line_number":187,"context_line":"                    _(\u0027content-type header required\u0027),"},{"line_number":188,"context_line":"                    json_formatter\u003dutil.json_error_formatter)"}],"source_content_type":"text/x-python","patch_set":8,"id":"7ffa3b31_21b28f95","line":185,"range":{"start_line":185,"start_character":41,"end_line":185,"end_character":45},"updated":"2017-04-18 14:32:48.000000000","message":"ditto","commit_id":"7a85b45b71eae5e4e48724dca4fb0538f60e06b5"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"21885e181a1cecfb3917d6cab5d6a8c357635a45","unresolved":false,"context_lines":[{"line_number":182,"context_line":"        # header that is not empty. If not raise a 400."},{"line_number":183,"context_line":"        try:"},{"line_number":184,"context_line":"            if (environ.get(\u0027CONTENT_LENGTH\u0027) and"},{"line_number":185,"context_line":"               int(environ.get(\u0027CONTENT_LENGTH\u0027)) and"},{"line_number":186,"context_line":"               not environ.get(\u0027CONTENT_TYPE\u0027)):"},{"line_number":187,"context_line":"                    raise webob.exc.HTTPBadRequest("},{"line_number":188,"context_line":"                        _(\u0027content-type header required\u0027),"}],"source_content_type":"text/x-python","patch_set":9,"id":"7ffa3b31_590e9232","line":185,"updated":"2017-04-19 13:08:59.000000000","message":"I think this is more readable if you do:\n\ncontent_length \u003d environ.get(\u0027CONTENT_LENGTH\u0027)\nif (content_length and int(content_length) and\n    not environ.get(\u0027CONTENT_TYPE\u0027)):\n  [etc]\n\nor something along those lines","commit_id":"0896b580e8e9cbdae254569b6f877e26978af764"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"21885e181a1cecfb3917d6cab5d6a8c357635a45","unresolved":false,"context_lines":[{"line_number":189,"context_line":"                        json_formatter\u003dutil.json_error_formatter)"},{"line_number":190,"context_line":"        except ValueError as exc:"},{"line_number":191,"context_line":"            raise webob.exc.HTTPBadRequest("},{"line_number":192,"context_line":"                _(\u0027content-type header not an integer\u0027),"},{"line_number":193,"context_line":"                json_formatter\u003dutil.json_error_formatter)"},{"line_number":194,"context_line":"        try:"},{"line_number":195,"context_line":"            return dispatch(environ, start_response, self._map)"}],"source_content_type":"text/x-python","patch_set":9,"id":"7ffa3b31_19180a73","line":192,"updated":"2017-04-19 13:08:59.000000000","message":"length not type here","commit_id":"0896b580e8e9cbdae254569b6f877e26978af764"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"a71a13abe37e0b1d52c58ee79fb45d10d414703f","unresolved":false,"context_lines":[{"line_number":185,"context_line":"            if (content_length and (int(content_length) \u003e 0) and"},{"line_number":186,"context_line":"               not environ.get(\u0027CONTENT_TYPE\u0027)):"},{"line_number":187,"context_line":"                    raise webob.exc.HTTPBadRequest("},{"line_number":188,"context_line":"                        _(\u0027content-type header required\u0027),"},{"line_number":189,"context_line":"                        json_formatter\u003dutil.json_error_formatter)"},{"line_number":190,"context_line":"        except ValueError as exc:"},{"line_number":191,"context_line":"            raise webob.exc.HTTPBadRequest("}],"source_content_type":"text/x-python","patch_set":12,"id":"7ffa3b31_b70b5a7b","line":188,"updated":"2017-04-19 15:46:14.000000000","message":"\"... when content-length \u003e 0\"?","commit_id":"6fd4401cb7db03ba8525dcbd2d2461f45adb692c"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"a71a13abe37e0b1d52c58ee79fb45d10d414703f","unresolved":false,"context_lines":[{"line_number":189,"context_line":"                        json_formatter\u003dutil.json_error_formatter)"},{"line_number":190,"context_line":"        except ValueError as exc:"},{"line_number":191,"context_line":"            raise webob.exc.HTTPBadRequest("},{"line_number":192,"context_line":"                _(\u0027content-length header not an integer\u0027),"},{"line_number":193,"context_line":"                json_formatter\u003dutil.json_error_formatter)"},{"line_number":194,"context_line":"        try:"},{"line_number":195,"context_line":"            return dispatch(environ, start_response, self._map)"}],"source_content_type":"text/x-python","patch_set":12,"id":"7ffa3b31_17a68e54","line":192,"range":{"start_line":192,"start_character":41,"end_line":192,"end_character":55},"updated":"2017-04-19 15:46:14.000000000","message":"or \"must be an integer\", to match structure of other error.","commit_id":"6fd4401cb7db03ba8525dcbd2d2461f45adb692c"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"23c34054c7855cc21e3cf6a8b19a1b7134470bd0","unresolved":false,"context_lines":[{"line_number":189,"context_line":"                        json_formatter\u003dutil.json_error_formatter)"},{"line_number":190,"context_line":"        except ValueError as exc:"},{"line_number":191,"context_line":"            raise webob.exc.HTTPBadRequest("},{"line_number":192,"context_line":"                _(\u0027content-length header not an integer\u0027),"},{"line_number":193,"context_line":"                json_formatter\u003dutil.json_error_formatter)"},{"line_number":194,"context_line":"        try:"},{"line_number":195,"context_line":"            return dispatch(environ, start_response, self._map)"}],"source_content_type":"text/x-python","patch_set":12,"id":"7ffa3b31_8557f626","line":192,"range":{"start_line":192,"start_character":41,"end_line":192,"end_character":55},"in_reply_to":"7ffa3b31_17a68e54","updated":"2017-04-20 03:17:25.000000000","message":"++","commit_id":"6fd4401cb7db03ba8525dcbd2d2461f45adb692c"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"5854efd6602cad48b17adaa354082811d84a419b","unresolved":false,"context_lines":[{"line_number":181,"context_line":"        # that is an integer \u003e 0 and not empty, also has a content-type"},{"line_number":182,"context_line":"        # header that is not empty. If not raise a 400."},{"line_number":183,"context_line":"        try:"},{"line_number":184,"context_line":"            content_length \u003d environ.get(\u0027CONTENT_LENGTH\u0027)"},{"line_number":185,"context_line":"            if (content_length and (int(content_length) \u003e 0) and"},{"line_number":186,"context_line":"               not environ.get(\u0027CONTENT_TYPE\u0027)):"},{"line_number":187,"context_line":"                    raise webob.exc.HTTPBadRequest("}],"source_content_type":"text/x-python","patch_set":13,"id":"7ffa3b31_f23c29c9","line":184,"range":{"start_line":184,"start_character":12,"end_line":184,"end_character":58},"updated":"2017-04-20 15:55:12.000000000","message":"nit: You don\u0027t need to put this inside the try (/me doesn\u0027t know what that \"principle\" is called)","commit_id":"5b1e6bdb246eadb8bd5a746f168748d1e9971f3b"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"5854efd6602cad48b17adaa354082811d84a419b","unresolved":false,"context_lines":[{"line_number":183,"context_line":"        try:"},{"line_number":184,"context_line":"            content_length \u003d environ.get(\u0027CONTENT_LENGTH\u0027)"},{"line_number":185,"context_line":"            if (content_length and (int(content_length) \u003e 0) and"},{"line_number":186,"context_line":"               not environ.get(\u0027CONTENT_TYPE\u0027)):"},{"line_number":187,"context_line":"                    raise webob.exc.HTTPBadRequest("},{"line_number":188,"context_line":"                        _(\u0027content-type header required when \u0027"},{"line_number":189,"context_line":"                          \u0027content-length \u003e 0\u0027),"}],"source_content_type":"text/x-python","patch_set":13,"id":"7ffa3b31_b247c14c","line":186,"updated":"2017-04-20 15:55:12.000000000","message":"nit: indentation looks off here, but I\u0027m assuming flake8 is happy so meh","commit_id":"5b1e6bdb246eadb8bd5a746f168748d1e9971f3b"},{"author":{"_account_id":2799,"name":"Andy McCrae","email":"andy.mccrae@googlemail.com","username":"andrew-mccrae"},"change_message_id":"6cc6f8995e6e1ea26a0f23c954f3b7efdb1c0017","unresolved":false,"context_lines":[{"line_number":183,"context_line":"        try:"},{"line_number":184,"context_line":"            content_length \u003d environ.get(\u0027CONTENT_LENGTH\u0027)"},{"line_number":185,"context_line":"            if (content_length and (int(content_length) \u003e 0) and"},{"line_number":186,"context_line":"               not environ.get(\u0027CONTENT_TYPE\u0027)):"},{"line_number":187,"context_line":"                    raise webob.exc.HTTPBadRequest("},{"line_number":188,"context_line":"                        _(\u0027content-type header required when \u0027"},{"line_number":189,"context_line":"                          \u0027content-length \u003e 0\u0027),"}],"source_content_type":"text/x-python","patch_set":13,"id":"7ffa3b31_c0b49a82","line":186,"in_reply_to":"7ffa3b31_b247c14c","updated":"2017-04-21 11:59:12.000000000","message":"I think it looks weird because of the line continuation - so its a multiple of 4 from the \"if (cont...), but not \"not environ...\". I\u0027m not too sure how to fix that to look best - happy to take advice on that though!","commit_id":"5b1e6bdb246eadb8bd5a746f168748d1e9971f3b"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"2cf84cd665af7b63974303487f5c9d6f323c9c65","unresolved":false,"context_lines":[{"line_number":183,"context_line":"        content_length \u003d environ.get(\u0027CONTENT_LENGTH\u0027)"},{"line_number":184,"context_line":"        try:"},{"line_number":185,"context_line":"            if (content_length and (int(content_length) \u003e 0) and"},{"line_number":186,"context_line":"               not environ.get(\u0027CONTENT_TYPE\u0027)):"},{"line_number":187,"context_line":"                    raise webob.exc.HTTPBadRequest("},{"line_number":188,"context_line":"                        _(\u0027content-type header required when \u0027"},{"line_number":189,"context_line":"                          \u0027content-length \u003e 0\u0027),"}],"source_content_type":"text/x-python","patch_set":14,"id":"7ffa3b31_6d981e74","line":186,"range":{"start_line":186,"start_character":12,"end_line":186,"end_character":15},"updated":"2017-04-21 12:55:08.000000000","message":"It\u0027s actually three spaces from the last one :)  Funny, my IDE (PyCharm) doesn\u0027t complain when it\u0027s three spaces, but it does when it\u0027s four, because then it lines up with (where) the next line (should be).\n\nIn any case, we have the pep8 rule that checks for this stuff turned off [1] so you\u0027re not getting any love there.\n\nWe\u0027re seriously beating a dead horse at this point, but if you really want to fix it, you could rename content_length to something shorter and fit the whole condition on one line (and then unindent the raise and fit the exception text on one line).  E.g.:\n\n        clen \u003d environ.get(\u0027CONTENT_LENGTH\u0027)\n        try:\n            if clen and (int(clen) \u003e 0) and not environ.get(\u0027CONTENT_TYPE\u0027):\n                raise webob.exc.HTTPBadRequest(\n                    _(\u0027content-type header required when content-length \u003e 0\u0027),\n                    json_formatter\u003dutil.json_error_formatter)\n\n\n[1] https://github.com/openstack/nova/blob/master/tox.ini#L167-L170","commit_id":"43293454596fcd8d651f40383a805e503367d37e"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"879ee625853b59d9dffb572dedc1dfba6f0b10d5","unresolved":false,"context_lines":[{"line_number":182,"context_line":"        # header that is not empty. If not raise a 400."},{"line_number":183,"context_line":"        clen \u003d environ.get(\u0027CONTENT_LENGTH\u0027)"},{"line_number":184,"context_line":"        try:"},{"line_number":185,"context_line":"            if (clen and (int(clen) \u003e 0) and not environ.get(\u0027CONTENT_TYPE\u0027)):"},{"line_number":186,"context_line":"                raise webob.exc.HTTPBadRequest("},{"line_number":187,"context_line":"                   _(\u0027content-type header required when \u0027"},{"line_number":188,"context_line":"                     \u0027content-length \u003e 0\u0027),"}],"source_content_type":"text/x-python","patch_set":15,"id":"7ffa3b31_f023e5a5","line":185,"updated":"2017-04-21 13:12:33.000000000","message":"Two pairs of parens are redundant on this line.","commit_id":"b6618323e51709d36bf22cb8529681074274b988"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"879ee625853b59d9dffb572dedc1dfba6f0b10d5","unresolved":false,"context_lines":[{"line_number":184,"context_line":"        try:"},{"line_number":185,"context_line":"            if (clen and (int(clen) \u003e 0) and not environ.get(\u0027CONTENT_TYPE\u0027)):"},{"line_number":186,"context_line":"                raise webob.exc.HTTPBadRequest("},{"line_number":187,"context_line":"                   _(\u0027content-type header required when \u0027"},{"line_number":188,"context_line":"                     \u0027content-length \u003e 0\u0027),"},{"line_number":189,"context_line":"                   json_formatter\u003dutil.json_error_formatter)"},{"line_number":190,"context_line":"        except ValueError as exc:"},{"line_number":191,"context_line":"            raise webob.exc.HTTPBadRequest("}],"source_content_type":"text/x-python","patch_set":15,"id":"7ffa3b31_d03ea9bf","line":188,"range":{"start_line":187,"start_character":0,"end_line":188,"end_character":43},"updated":"2017-04-21 13:12:33.000000000","message":"This can be put on one line now.","commit_id":"b6618323e51709d36bf22cb8529681074274b988"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"539be82564861ef472eb3ab8908a73329bf9afec","unresolved":false,"context_lines":[{"line_number":182,"context_line":"        # header that is not empty. If not raise a 400."},{"line_number":183,"context_line":"        clen \u003d environ.get(\u0027CONTENT_LENGTH\u0027)"},{"line_number":184,"context_line":"        try:"},{"line_number":185,"context_line":"            if (clen and int(clen) \u003e 0 and not environ.get(\u0027CONTENT_TYPE\u0027)):"},{"line_number":186,"context_line":"                raise webob.exc.HTTPBadRequest("},{"line_number":187,"context_line":"                   _(\u0027content-type header required when content-length \u003e 0\u0027),"},{"line_number":188,"context_line":"                   json_formatter\u003dutil.json_error_formatter)"}],"source_content_type":"text/x-python","patch_set":16,"id":"7ffa3b31_2198dd67","line":185,"range":{"start_line":185,"start_character":15,"end_line":185,"end_character":16},"updated":"2017-04-21 15:10:58.000000000","message":"And this one.  (Actually, mainly this one.  pep8 might flag this, whereas the other one was optional but nice for readability.)","commit_id":"386d51c97350e1929146d08b4732ac760a46c220"}],"nova/tests/unit/api/openstack/placement/test_handler.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"a71a13abe37e0b1d52c58ee79fb45d10d414703f","unresolved":false,"context_lines":[{"line_number":147,"context_line":"class ContentHeadersTest(test.NoDBTestCase):"},{"line_number":148,"context_line":""},{"line_number":149,"context_line":"    def test_no_content_type(self):"},{"line_number":150,"context_line":"        environ \u003d _environ(path\u003d\u0027/\u0027)"},{"line_number":151,"context_line":"        environ[\u0027CONTENT_LENGTH\u0027] \u003d \u002710\u0027"},{"line_number":152,"context_line":"        app \u003d handler.PlacementHandler()"},{"line_number":153,"context_line":"        self.assertRaisesRegex(webob.exc.HTTPBadRequest,"}],"source_content_type":"text/x-python","patch_set":12,"id":"7ffa3b31_f7bfa25e","line":150,"updated":"2017-04-19 15:46:14.000000000","message":"Could do _environ() and PlacementHandler() in setUp() and save, like, five whole lines of code.","commit_id":"6fd4401cb7db03ba8525dcbd2d2461f45adb692c"}]}
