)]}'
{"neutron/api/v2/attributes.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"fb8967f4a649f8a0612f58e1c5684d624ff7aff7","unresolved":false,"context_lines":[{"line_number":157,"context_line":"    try:"},{"line_number":158,"context_line":"        valid_mac \u003d netaddr.valid_mac(_validate_no_whitespace(data))"},{"line_number":159,"context_line":"    except Exception:"},{"line_number":160,"context_line":"        pass"},{"line_number":161,"context_line":"    finally:"},{"line_number":162,"context_line":"        # TODO(arosen): The code in this file should be refactored"},{"line_number":163,"context_line":"        # so it catches the correct exceptions. _validate_no_whitespace"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAWH%2F%2FltE%3D","line":160,"updated":"2014-03-15 20:25:22.000000000","message":"Hi Aaron, in the commit message you write:\n\n\"netaddr.valid_mac() instead which returns a bool if a mac is\nvalid or not and does not raise.\"\n\nThat seems to indicate that you should remove the try/except Exception block above. I believe it is safer to remove the except: pass block since it\u0027s possible that could mask errors.","commit_id":"2745f49e80c38a7f255f4002bb6977aa35378ed3"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"0b74dee734f604d16c1eb4fc0ba3008a9812dc22","unresolved":false,"context_lines":[{"line_number":157,"context_line":"    try:"},{"line_number":158,"context_line":"        valid_mac \u003d netaddr.valid_mac(_validate_no_whitespace(data))"},{"line_number":159,"context_line":"    except Exception:"},{"line_number":160,"context_line":"        pass"},{"line_number":161,"context_line":"    finally:"},{"line_number":162,"context_line":"        # TODO(arosen): The code in this file should be refactored"},{"line_number":163,"context_line":"        # so it catches the correct exceptions. _validate_no_whitespace"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAWH%2F%2FcZo%3D","line":160,"in_reply_to":"AAAAWH%2F%2FhCs%3D","updated":"2014-03-17 21:19:02.000000000","message":"Please see the comment in the finally statement..","commit_id":"2745f49e80c38a7f255f4002bb6977aa35378ed3"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"e497301a0da10abc129ce1dd9a5077eef2e07657","unresolved":false,"context_lines":[{"line_number":157,"context_line":"    try:"},{"line_number":158,"context_line":"        valid_mac \u003d netaddr.valid_mac(_validate_no_whitespace(data))"},{"line_number":159,"context_line":"    except Exception:"},{"line_number":160,"context_line":"        pass"},{"line_number":161,"context_line":"    finally:"},{"line_number":162,"context_line":"        # TODO(arosen): The code in this file should be refactored"},{"line_number":163,"context_line":"        # so it catches the correct exceptions. _validate_no_whitespace"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAWH%2F%2FhCs%3D","line":160,"in_reply_to":"AAAAWH%2F%2FltE%3D","updated":"2014-03-17 12:12:24.000000000","message":"+1","commit_id":"2745f49e80c38a7f255f4002bb6977aa35378ed3"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"7234008b35eaf734ea048122783e0a89fcc38a0f","unresolved":false,"context_lines":[{"line_number":162,"context_line":"        # TODO(arosen): The code in this file should be refactored"},{"line_number":163,"context_line":"        # so it catches the correct exceptions. _validate_no_whitespace"},{"line_number":164,"context_line":"        # raises AttributeError if data is None."},{"line_number":165,"context_line":"        if valid_mac is False:"},{"line_number":166,"context_line":"            msg \u003d _(\"\u0027%s\u0027 is not a valid MAC address\") % data"},{"line_number":167,"context_line":"            LOG.debug(msg)"},{"line_number":168,"context_line":"            return msg"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAWH%2F%2FmvI%3D","line":165,"updated":"2014-03-15 07:18:15.000000000","message":"I think it can be just\n if not valid_mac:","commit_id":"2745f49e80c38a7f255f4002bb6977aa35378ed3"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"72e706f6c3448769d5480476d645786deeb5a8df","unresolved":false,"context_lines":[{"line_number":162,"context_line":"        # TODO(arosen): The code in this file should be refactored"},{"line_number":163,"context_line":"        # so it catches the correct exceptions. _validate_no_whitespace"},{"line_number":164,"context_line":"        # raises AttributeError if data is None."},{"line_number":165,"context_line":"        if valid_mac is False:"},{"line_number":166,"context_line":"            msg \u003d _(\"\u0027%s\u0027 is not a valid MAC address\") % data"},{"line_number":167,"context_line":"            LOG.debug(msg)"},{"line_number":168,"context_line":"            return msg"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAWH%2F%2FmtM%3D","line":165,"in_reply_to":"AAAAWH%2F%2FmvI%3D","updated":"2014-03-15 07:34:21.000000000","message":"sure that could work as well though I don\u0027t see anything wrong with explicitly checking the type here. Why?","commit_id":"2745f49e80c38a7f255f4002bb6977aa35378ed3"},{"author":{"_account_id":1935,"name":"Tomoe Sugihara","email":"tomoe.sugihara@gmail.com","username":"tomoe"},"change_message_id":"deb4f8a3a760434aa2a55b87fd49f73ce4b83e6d","unresolved":false,"context_lines":[{"line_number":145,"context_line":""},{"line_number":146,"context_line":"def _validate_no_whitespace(data):"},{"line_number":147,"context_line":"    \"\"\"Validates that input has no whitespace.\"\"\""},{"line_number":148,"context_line":"    if len(data.split()) \u003e 1:"},{"line_number":149,"context_line":"        msg \u003d _(\"\u0027%s\u0027 contains whitespace\") % data"},{"line_number":150,"context_line":"        LOG.debug(msg)"},{"line_number":151,"context_line":"        raise n_exc.InvalidInput(error_message\u003dmsg)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAWH%2F%2Bzhw%3D","line":148,"updated":"2014-03-24 07:41:33.000000000","message":"Sorry, not a comment for this change, but caught my eye. \nLeading and trailing spaces would escape this validation, since str.split() would trim them. If that behavior is expected, function name should be changed or at least documented properly. \n\nIf this function tries to validate \"no_whitespace\" in the entire input string, something like \" \" in data would do.","commit_id":"b9390333a146d0435710f85d365318268e267fc3"},{"author":{"_account_id":6598,"name":"Berezovsky Irena","email":"irenab.dev@gmail.com","username":"irenab"},"change_message_id":"634d14f7289b92f0ebd0e239cd55479e460dc4b5","unresolved":false,"context_lines":[{"line_number":152,"context_line":"    return data"},{"line_number":153,"context_line":""},{"line_number":154,"context_line":""},{"line_number":155,"context_line":"def _validate_mac_address(data, valid_values\u003dNone):"},{"line_number":156,"context_line":"    valid_mac \u003d False"},{"line_number":157,"context_line":"    try:"},{"line_number":158,"context_line":"        valid_mac \u003d netaddr.valid_mac(_validate_no_whitespace(data))"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAWH%2F%2Bz6A%3D","line":155,"updated":"2014-03-24 05:57:26.000000000","message":"is valid_values needed? It is not used in scope of this method","commit_id":"b9390333a146d0435710f85d365318268e267fc3"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"a1d31c75cc22cf8e91f9eb6d552f8b9b1315124b","unresolved":false,"context_lines":[{"line_number":152,"context_line":"    return data"},{"line_number":153,"context_line":""},{"line_number":154,"context_line":""},{"line_number":155,"context_line":"def _validate_mac_address(data, valid_values\u003dNone):"},{"line_number":156,"context_line":"    valid_mac \u003d False"},{"line_number":157,"context_line":"    try:"},{"line_number":158,"context_line":"        valid_mac \u003d netaddr.valid_mac(_validate_no_whitespace(data))"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAWH%2F9SP0%3D","line":155,"in_reply_to":"AAAAWH%2F%2Bz4s%3D","updated":"2014-04-07 12:01:36.000000000","message":"Each validator here is called from API framework and it assumes valid_values is there even if it is not used.","commit_id":"b9390333a146d0435710f85d365318268e267fc3"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"ee7342a5cdfc621a2d6b9d4c4456d4f8429063cb","unresolved":false,"context_lines":[{"line_number":152,"context_line":"    return data"},{"line_number":153,"context_line":""},{"line_number":154,"context_line":""},{"line_number":155,"context_line":"def _validate_mac_address(data, valid_values\u003dNone):"},{"line_number":156,"context_line":"    valid_mac \u003d False"},{"line_number":157,"context_line":"    try:"},{"line_number":158,"context_line":"        valid_mac \u003d netaddr.valid_mac(_validate_no_whitespace(data))"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAWH%2F%2Bz4s%3D","line":155,"in_reply_to":"AAAAWH%2F%2Bz6A%3D","updated":"2014-03-24 05:59:19.000000000","message":"i think that validate framework code below assumes it need s to be there.  this patch doesn\u0027t touch valid_values","commit_id":"b9390333a146d0435710f85d365318268e267fc3"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"a1d31c75cc22cf8e91f9eb6d552f8b9b1315124b","unresolved":false,"context_lines":[{"line_number":161,"context_line":"    finally:"},{"line_number":162,"context_line":"        # TODO(arosen): The code in this file should be refactored"},{"line_number":163,"context_line":"        # so it catches the correct exceptions. _validate_no_whitespace"},{"line_number":164,"context_line":"        # raises AttributeError if data is None."},{"line_number":165,"context_line":"        if valid_mac is False:"},{"line_number":166,"context_line":"            msg \u003d _(\"\u0027%s\u0027 is not a valid MAC address\") % data"},{"line_number":167,"context_line":"            LOG.debug(msg)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAWH%2F9SPk%3D","line":164,"updated":"2014-04-07 12:01:36.000000000","message":"Totally agree. Most validators return None if succeed or error messages if errors, but some do not. We need to define the interface and refactor validators.\n\nFirst I would like to move validators and converters into separate modules.","commit_id":"b9390333a146d0435710f85d365318268e267fc3"}],"neutron/tests/unit/test_attributes.py":[{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"e497301a0da10abc129ce1dd9a5077eef2e07657","unresolved":false,"context_lines":[{"line_number":180,"context_line":""},{"line_number":181,"context_line":"        mac_addr \u003d \"123\""},{"line_number":182,"context_line":"        msg \u003d validator(mac_addr)"},{"line_number":183,"context_line":"        self.assertEqual(msg, \"\u0027%s\u0027 is not a valid MAC address\" % mac_addr)"},{"line_number":184,"context_line":""},{"line_number":185,"context_line":"        mac_addr \u003d None"},{"line_number":186,"context_line":"        msg \u003d validator(mac_addr)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAWH%2F%2FhDo%3D","line":183,"updated":"2014-03-17 12:12:24.000000000","message":"nit: can have a string constant and use it on 179, 183, 190","commit_id":"2745f49e80c38a7f255f4002bb6977aa35378ed3"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"3450f5607bb6506a6ca206bf31a2084988f7e683","unresolved":false,"context_lines":[{"line_number":180,"context_line":""},{"line_number":181,"context_line":"        mac_addr \u003d \"123\""},{"line_number":182,"context_line":"        msg \u003d validator(mac_addr)"},{"line_number":183,"context_line":"        self.assertEqual(msg, \"\u0027%s\u0027 is not a valid MAC address\" % mac_addr)"},{"line_number":184,"context_line":""},{"line_number":185,"context_line":"        mac_addr \u003d None"},{"line_number":186,"context_line":"        msg \u003d validator(mac_addr)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAWH%2F%2FcBg%3D","line":183,"in_reply_to":"AAAAWH%2F%2FhDo%3D","updated":"2014-03-17 22:11:19.000000000","message":"Done","commit_id":"2745f49e80c38a7f255f4002bb6977aa35378ed3"}]}
