)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":15830,"name":"jiaxi","email":"jiaxi@unitedstack.com","username":"jiaxi"},"change_message_id":"98e2ca850d51df9e5afb01326e597f49a7158e44","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Show helpful message when request body is not provided"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Avoid showing python error when no or empty request body is provided"},{"line_number":10,"context_line":"for creating or updating request, giving some useful information instead."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Closes-Bug: #1468597"},{"line_number":13,"context_line":"Closes-Bug: #1466872"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":15,"id":"3a50d1a3_105fed0f","line":10,"updated":"2015-07-28 14:17:44.000000000","message":"updating (a) request.  giving -\u003e providing","commit_id":"28d1e59ac33682a64d05b2847e2ece6e77022bf4"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"c427d71e0c27d05487527c932d8c0df393ddca80","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Show helpful message when request body is not provided"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Avoid showing python error when no or empty request body is provided"},{"line_number":10,"context_line":"for creating or updating request, giving some useful information instead."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Closes-Bug: #1468597"},{"line_number":13,"context_line":"Closes-Bug: #1466872"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":15,"id":"3a50d1a3_9f8e8577","line":10,"in_reply_to":"3a50d1a3_105fed0f","updated":"2015-07-29 07:29:53.000000000","message":"not updating *a* request, but the creating or updating request, such as post or put http request.","commit_id":"28d1e59ac33682a64d05b2847e2ece6e77022bf4"}],"keystone/common/validation/__init__.py":[{"author":{"_account_id":5707,"name":"Henry Nash","email":"henryn@linux.vnet.ibm.com","username":"henry-nash"},"change_message_id":"a1c437c66c776fd216b07f49f7fdcabab5a602ae","unresolved":false,"context_lines":[{"line_number":40,"context_line":"            # `resource_to_validate` is not passed in or passed with an empty"},{"line_number":41,"context_line":"            # value will raise the exception to indicate the request body is"},{"line_number":42,"context_line":"            # needed."},{"line_number":43,"context_line":"            LOG.debug(\u0027resource to be validated: \"%s\"\u0027, resource_to_validate)"},{"line_number":44,"context_line":"            if not kwargs.get(resource_to_validate, None):"},{"line_number":45,"context_line":"                raise exception.ValidationError(attribute\u003dresource_to_validate,"},{"line_number":46,"context_line":"                                                target\u003d\u0027request body\u0027)"}],"source_content_type":"text/x-python","patch_set":12,"id":"9a41bdd9_754e223c","line":43,"updated":"2015-07-16 09:47:35.000000000","message":"so this could be very chatty (i.e. fill the logs!!), are we sure we need to log every call here?","commit_id":"7854f9950c8ece189731a7aa6a1ea9ac04ca25cf"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"bc39b7ec51ed65b324290a8590468e6be5348670","unresolved":false,"context_lines":[{"line_number":40,"context_line":"            # `resource_to_validate` is not passed in or passed with an empty"},{"line_number":41,"context_line":"            # value will raise the exception to indicate the request body is"},{"line_number":42,"context_line":"            # needed."},{"line_number":43,"context_line":"            LOG.debug(\u0027resource to be validated: \"%s\"\u0027, resource_to_validate)"},{"line_number":44,"context_line":"            if not kwargs.get(resource_to_validate, None):"},{"line_number":45,"context_line":"                raise exception.ValidationError(attribute\u003dresource_to_validate,"},{"line_number":46,"context_line":"                                                target\u003d\u0027request body\u0027)"}],"source_content_type":"text/x-python","patch_set":12,"id":"9a41bdd9_3e4872b2","line":43,"in_reply_to":"9a41bdd9_754e223c","updated":"2015-07-16 12:27:15.000000000","message":"Done","commit_id":"7854f9950c8ece189731a7aa6a1ea9ac04ca25cf"},{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"3a1e7366c78456080363bc5d394c639bd965bfd0","unresolved":false,"context_lines":[{"line_number":32,"context_line":"    def add_validator(func):"},{"line_number":33,"context_line":"        @functools.wraps(func)"},{"line_number":34,"context_line":"        def wrapper(*args, **kwargs):"},{"line_number":35,"context_line":"            # `resource_to_validate` is not passed in or passed with an empty"},{"line_number":36,"context_line":"            # value will raise the exception to indicate the request body is"},{"line_number":37,"context_line":"            # needed."},{"line_number":38,"context_line":"            if not kwargs.get(resource_to_validate, None):"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a50d1a3_f63aa733","line":35,"updated":"2015-07-27 18:22:32.000000000","message":"(nit) If `resource_to_validate` ...","commit_id":"e1a8679384857f08053c5d76cea646263a46c137"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"db274fbe685bcba69b342a06d802a5ff37287036","unresolved":false,"context_lines":[{"line_number":32,"context_line":"    def add_validator(func):"},{"line_number":33,"context_line":"        @functools.wraps(func)"},{"line_number":34,"context_line":"        def wrapper(*args, **kwargs):"},{"line_number":35,"context_line":"            # `resource_to_validate` is not passed in or passed with an empty"},{"line_number":36,"context_line":"            # value will raise the exception to indicate the request body is"},{"line_number":37,"context_line":"            # needed."},{"line_number":38,"context_line":"            if not kwargs.get(resource_to_validate, None):"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a50d1a3_7aa17293","line":35,"in_reply_to":"3a50d1a3_f63aa733","updated":"2015-07-28 13:57:30.000000000","message":"Done","commit_id":"e1a8679384857f08053c5d76cea646263a46c137"},{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"3a1e7366c78456080363bc5d394c639bd965bfd0","unresolved":false,"context_lines":[{"line_number":34,"context_line":"        def wrapper(*args, **kwargs):"},{"line_number":35,"context_line":"            # `resource_to_validate` is not passed in or passed with an empty"},{"line_number":36,"context_line":"            # value will raise the exception to indicate the request body is"},{"line_number":37,"context_line":"            # needed."},{"line_number":38,"context_line":"            if not kwargs.get(resource_to_validate, None):"},{"line_number":39,"context_line":"                raise exception.ValidationError(attribute\u003dresource_to_validate,"},{"line_number":40,"context_line":"                                                target\u003d\u0027request body\u0027)"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a50d1a3_d6268b15","line":37,"updated":"2015-07-27 18:22:32.000000000","message":"Do we have any reason to allow empty bodies? As in {}? I would assume that if it isn\u0027t valid now that it could be in the future.  jsonschema should catch empty bodies that are missing required attributes.","commit_id":"e1a8679384857f08053c5d76cea646263a46c137"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"db274fbe685bcba69b342a06d802a5ff37287036","unresolved":false,"context_lines":[{"line_number":34,"context_line":"        def wrapper(*args, **kwargs):"},{"line_number":35,"context_line":"            # `resource_to_validate` is not passed in or passed with an empty"},{"line_number":36,"context_line":"            # value will raise the exception to indicate the request body is"},{"line_number":37,"context_line":"            # needed."},{"line_number":38,"context_line":"            if not kwargs.get(resource_to_validate, None):"},{"line_number":39,"context_line":"                raise exception.ValidationError(attribute\u003dresource_to_validate,"},{"line_number":40,"context_line":"                                                target\u003d\u0027request body\u0027)"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a50d1a3_9aac7e89","line":37,"in_reply_to":"3a50d1a3_37178346","updated":"2015-07-28 13:57:30.000000000","message":"David, thanks for your investigation and time!","commit_id":"e1a8679384857f08053c5d76cea646263a46c137"},{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"8f833ebf8be6d70bfe60246e26e7ca1dda7eaef3","unresolved":false,"context_lines":[{"line_number":34,"context_line":"        def wrapper(*args, **kwargs):"},{"line_number":35,"context_line":"            # `resource_to_validate` is not passed in or passed with an empty"},{"line_number":36,"context_line":"            # value will raise the exception to indicate the request body is"},{"line_number":37,"context_line":"            # needed."},{"line_number":38,"context_line":"            if not kwargs.get(resource_to_validate, None):"},{"line_number":39,"context_line":"                raise exception.ValidationError(attribute\u003dresource_to_validate,"},{"line_number":40,"context_line":"                                                target\u003d\u0027request body\u0027)"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a50d1a3_37178346","line":37,"in_reply_to":"3a50d1a3_d6268b15","updated":"2015-07-28 13:25:49.000000000","message":"I\u0027m wrong here. While it\u0027s possible in HTTP, we are not doing this anywhere that I can tell.","commit_id":"e1a8679384857f08053c5d76cea646263a46c137"},{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"3a1e7366c78456080363bc5d394c639bd965bfd0","unresolved":false,"context_lines":[{"line_number":35,"context_line":"            # `resource_to_validate` is not passed in or passed with an empty"},{"line_number":36,"context_line":"            # value will raise the exception to indicate the request body is"},{"line_number":37,"context_line":"            # needed."},{"line_number":38,"context_line":"            if not kwargs.get(resource_to_validate, None):"},{"line_number":39,"context_line":"                raise exception.ValidationError(attribute\u003dresource_to_validate,"},{"line_number":40,"context_line":"                                                target\u003d\u0027request body\u0027)"},{"line_number":41,"context_line":"            if resource_to_validate in kwargs:"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a50d1a3_f6f3879d","line":38,"updated":"2015-07-27 18:22:32.000000000","message":"(nit) None is the default","commit_id":"e1a8679384857f08053c5d76cea646263a46c137"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"db274fbe685bcba69b342a06d802a5ff37287036","unresolved":false,"context_lines":[{"line_number":35,"context_line":"            # `resource_to_validate` is not passed in or passed with an empty"},{"line_number":36,"context_line":"            # value will raise the exception to indicate the request body is"},{"line_number":37,"context_line":"            # needed."},{"line_number":38,"context_line":"            if not kwargs.get(resource_to_validate, None):"},{"line_number":39,"context_line":"                raise exception.ValidationError(attribute\u003dresource_to_validate,"},{"line_number":40,"context_line":"                                                target\u003d\u0027request body\u0027)"},{"line_number":41,"context_line":"            if resource_to_validate in kwargs:"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a50d1a3_dab686db","line":38,"in_reply_to":"3a50d1a3_f6f3879d","updated":"2015-07-28 13:57:30.000000000","message":"Done","commit_id":"e1a8679384857f08053c5d76cea646263a46c137"},{"author":{"_account_id":15830,"name":"jiaxi","email":"jiaxi@unitedstack.com","username":"jiaxi"},"change_message_id":"98e2ca850d51df9e5afb01326e597f49a7158e44","unresolved":false,"context_lines":[{"line_number":33,"context_line":"        @functools.wraps(func)"},{"line_number":34,"context_line":"        def wrapper(*args, **kwargs):"},{"line_number":35,"context_line":"            # If `resource_to_validate` is not passed in or passed with an"},{"line_number":36,"context_line":"            # empty value will raise the exception to indicate the request"},{"line_number":37,"context_line":"            # body is needed."},{"line_number":38,"context_line":"            if not kwargs.get(resource_to_validate):"},{"line_number":39,"context_line":"                raise exception.ValidationError(attribute\u003dresource_to_validate,"}],"source_content_type":"text/x-python","patch_set":15,"id":"3a50d1a3_cd181287","line":36,"updated":"2015-07-28 14:17:44.000000000","message":"indicate后面加个that，that宾语从句，是不是更好点？","commit_id":"28d1e59ac33682a64d05b2847e2ece6e77022bf4"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"c427d71e0c27d05487527c932d8c0df393ddca80","unresolved":false,"context_lines":[{"line_number":33,"context_line":"        @functools.wraps(func)"},{"line_number":34,"context_line":"        def wrapper(*args, **kwargs):"},{"line_number":35,"context_line":"            # If `resource_to_validate` is not passed in or passed with an"},{"line_number":36,"context_line":"            # empty value will raise the exception to indicate the request"},{"line_number":37,"context_line":"            # body is needed."},{"line_number":38,"context_line":"            if not kwargs.get(resource_to_validate):"},{"line_number":39,"context_line":"                raise exception.ValidationError(attribute\u003dresource_to_validate,"}],"source_content_type":"text/x-python","patch_set":15,"id":"3a50d1a3_5f06bd86","line":36,"in_reply_to":"3a50d1a3_99c22533","updated":"2015-07-29 07:29:53.000000000","message":"Done","commit_id":"28d1e59ac33682a64d05b2847e2ece6e77022bf4"},{"author":{"_account_id":15830,"name":"jiaxi","email":"jiaxi@unitedstack.com","username":"jiaxi"},"change_message_id":"deb4a84b2884717aa4be8d17cec4a6423a64d2f3","unresolved":false,"context_lines":[{"line_number":33,"context_line":"        @functools.wraps(func)"},{"line_number":34,"context_line":"        def wrapper(*args, **kwargs):"},{"line_number":35,"context_line":"            # If `resource_to_validate` is not passed in or passed with an"},{"line_number":36,"context_line":"            # empty value will raise the exception to indicate the request"},{"line_number":37,"context_line":"            # body is needed."},{"line_number":38,"context_line":"            if not kwargs.get(resource_to_validate):"},{"line_number":39,"context_line":"                raise exception.ValidationError(attribute\u003dresource_to_validate,"}],"source_content_type":"text/x-python","patch_set":15,"id":"3a50d1a3_bc510f32","line":36,"in_reply_to":"3a50d1a3_99c22533","updated":"2015-07-29 07:10:31.000000000","message":"I mean add a \u0027that\u0027 after indicate maybe better","commit_id":"28d1e59ac33682a64d05b2847e2ece6e77022bf4"},{"author":{"_account_id":1941,"name":"Lin Hua Cheng","email":"os.lcheng@gmail.com","username":"lin-hua-cheng"},"change_message_id":"94a59549a146f63a95213fa233b265c0935e5adf","unresolved":false,"context_lines":[{"line_number":33,"context_line":"        @functools.wraps(func)"},{"line_number":34,"context_line":"        def wrapper(*args, **kwargs):"},{"line_number":35,"context_line":"            # If `resource_to_validate` is not passed in or passed with an"},{"line_number":36,"context_line":"            # empty value will raise the exception to indicate the request"},{"line_number":37,"context_line":"            # body is needed."},{"line_number":38,"context_line":"            if not kwargs.get(resource_to_validate):"},{"line_number":39,"context_line":"                raise exception.ValidationError(attribute\u003dresource_to_validate,"}],"source_content_type":"text/x-python","patch_set":15,"id":"3a50d1a3_1abfc7d0","line":36,"in_reply_to":"3a50d1a3_bc510f32","updated":"2015-07-29 17:14:02.000000000","message":"#translationFail :)","commit_id":"28d1e59ac33682a64d05b2847e2ece6e77022bf4"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"c427d71e0c27d05487527c932d8c0df393ddca80","unresolved":false,"context_lines":[{"line_number":33,"context_line":"        @functools.wraps(func)"},{"line_number":34,"context_line":"        def wrapper(*args, **kwargs):"},{"line_number":35,"context_line":"            # If `resource_to_validate` is not passed in or passed with an"},{"line_number":36,"context_line":"            # empty value will raise the exception to indicate the request"},{"line_number":37,"context_line":"            # body is needed."},{"line_number":38,"context_line":"            if not kwargs.get(resource_to_validate):"},{"line_number":39,"context_line":"                raise exception.ValidationError(attribute\u003dresource_to_validate,"}],"source_content_type":"text/x-python","patch_set":15,"id":"3a50d1a3_5fdf9d0c","line":36,"in_reply_to":"3a50d1a3_cd181287","updated":"2015-07-29 07:29:53.000000000","message":"Done","commit_id":"28d1e59ac33682a64d05b2847e2ece6e77022bf4"},{"author":{"_account_id":1941,"name":"Lin Hua Cheng","email":"os.lcheng@gmail.com","username":"lin-hua-cheng"},"change_message_id":"dddddacd9803cacdf118de017755fd50f26574fb","unresolved":false,"context_lines":[{"line_number":33,"context_line":"        @functools.wraps(func)"},{"line_number":34,"context_line":"        def wrapper(*args, **kwargs):"},{"line_number":35,"context_line":"            # If `resource_to_validate` is not passed in or passed with an"},{"line_number":36,"context_line":"            # empty value will raise the exception to indicate the request"},{"line_number":37,"context_line":"            # body is needed."},{"line_number":38,"context_line":"            if not kwargs.get(resource_to_validate):"},{"line_number":39,"context_line":"                raise exception.ValidationError(attribute\u003dresource_to_validate,"}],"source_content_type":"text/x-python","patch_set":15,"id":"3a50d1a3_99c22533","line":36,"in_reply_to":"3a50d1a3_cd181287","updated":"2015-07-29 06:37:00.000000000","message":"translation from google.translate: \"Later add that, that object clause, is not better\"  \n\nI still don\u0027t get the meaning :) would be nice if the comments are in english too\n\n\nsuggestion for readability:  \"# empty value, it will raise the exception to indicate the request\"\n\nAdded \", \"","commit_id":"28d1e59ac33682a64d05b2847e2ece6e77022bf4"},{"author":{"_account_id":1941,"name":"Lin Hua Cheng","email":"os.lcheng@gmail.com","username":"lin-hua-cheng"},"change_message_id":"dddddacd9803cacdf118de017755fd50f26574fb","unresolved":false,"context_lines":[{"line_number":35,"context_line":"            # If `resource_to_validate` is not passed in or passed with an"},{"line_number":36,"context_line":"            # empty value will raise the exception to indicate the request"},{"line_number":37,"context_line":"            # body is needed."},{"line_number":38,"context_line":"            if not kwargs.get(resource_to_validate):"},{"line_number":39,"context_line":"                raise exception.ValidationError(attribute\u003dresource_to_validate,"},{"line_number":40,"context_line":"                                                target\u003d\u0027request body\u0027)"},{"line_number":41,"context_line":"            if resource_to_validate in kwargs:"}],"source_content_type":"text/x-python","patch_set":15,"id":"3a50d1a3_b9f5a151","line":38,"updated":"2015-07-29 06:37:00.000000000","message":"question: why do we also want to raise an error if resource_to_validate is not passed in?","commit_id":"28d1e59ac33682a64d05b2847e2ece6e77022bf4"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"c427d71e0c27d05487527c932d8c0df393ddca80","unresolved":false,"context_lines":[{"line_number":35,"context_line":"            # If `resource_to_validate` is not passed in or passed with an"},{"line_number":36,"context_line":"            # empty value will raise the exception to indicate the request"},{"line_number":37,"context_line":"            # body is needed."},{"line_number":38,"context_line":"            if not kwargs.get(resource_to_validate):"},{"line_number":39,"context_line":"                raise exception.ValidationError(attribute\u003dresource_to_validate,"},{"line_number":40,"context_line":"                                                target\u003d\u0027request body\u0027)"},{"line_number":41,"context_line":"            if resource_to_validate in kwargs:"}],"source_content_type":"text/x-python","patch_set":15,"id":"3a50d1a3_ffc78942","line":38,"in_reply_to":"3a50d1a3_b9f5a151","updated":"2015-07-29 07:29:53.000000000","message":"@Lin, This is what we want to address, when there is no or empty request body in the http request, we should captch it in the validation or else it will throw python exception,  and the  python exception is helpless for end user.\n\nsee： https://bugs.launchpad.net/keystone/+bug/1466872\n\nkwargs includes the request body if there is, \u0027resource_to_validate\u0027 is just the key of the dict, this is a simply approach to address all of the creating or updating request without body.","commit_id":"28d1e59ac33682a64d05b2847e2ece6e77022bf4"},{"author":{"_account_id":1941,"name":"Lin Hua Cheng","email":"os.lcheng@gmail.com","username":"lin-hua-cheng"},"change_message_id":"94a59549a146f63a95213fa233b265c0935e5adf","unresolved":false,"context_lines":[{"line_number":35,"context_line":"            # If `resource_to_validate` is not passed in or passed with an"},{"line_number":36,"context_line":"            # empty value will raise the exception to indicate the request"},{"line_number":37,"context_line":"            # body is needed."},{"line_number":38,"context_line":"            if not kwargs.get(resource_to_validate):"},{"line_number":39,"context_line":"                raise exception.ValidationError(attribute\u003dresource_to_validate,"},{"line_number":40,"context_line":"                                                target\u003d\u0027request body\u0027)"},{"line_number":41,"context_line":"            if resource_to_validate in kwargs:"}],"source_content_type":"text/x-python","patch_set":15,"id":"3a50d1a3_5aea2fd9","line":38,"in_reply_to":"3a50d1a3_ffc78942","updated":"2015-07-29 17:14:02.000000000","message":"cool, thanks","commit_id":"28d1e59ac33682a64d05b2847e2ece6e77022bf4"},{"author":{"_account_id":1941,"name":"Lin Hua Cheng","email":"os.lcheng@gmail.com","username":"lin-hua-cheng"},"change_message_id":"c5b4e3997c410c001d900b59bc0a45d9fcf07339","unresolved":false,"context_lines":[{"line_number":25,"context_line":""},{"line_number":26,"context_line":"    :param request_body_schema: a schema to validate the resource reference"},{"line_number":27,"context_line":"    :param resource_to_validate: the reference to validate"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"    \"\"\""},{"line_number":30,"context_line":"    schema_validator \u003d validators.SchemaValidator(request_body_schema)"},{"line_number":31,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"3a50d1a3_baad7385","line":28,"updated":"2015-07-29 17:17:40.000000000","message":"sorry, missed this in the last review\n\nUpdate the doc to include the new exception that will be raised:\n\n:raises: keystone.exception.ValidationError","commit_id":"4e9b006b911111dec6c29efbb1ec4c496c1cde80"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"a27c0fd5af595a575dcddc2865d75b389b8b2de1","unresolved":false,"context_lines":[{"line_number":25,"context_line":""},{"line_number":26,"context_line":"    :param request_body_schema: a schema to validate the resource reference"},{"line_number":27,"context_line":"    :param resource_to_validate: the reference to validate"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"    \"\"\""},{"line_number":30,"context_line":"    schema_validator \u003d validators.SchemaValidator(request_body_schema)"},{"line_number":31,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"3a50d1a3_d16feefa","line":28,"in_reply_to":"3a50d1a3_baad7385","updated":"2015-07-30 02:49:19.000000000","message":"Good catch. :)","commit_id":"4e9b006b911111dec6c29efbb1ec4c496c1cde80"},{"author":{"_account_id":6486,"name":"Brant Knudson","email":"blk@acm.org","username":"blk-u"},"change_message_id":"2d0c762ac4b1817ee9d1d64e671556a6a401827e","unresolved":false,"context_lines":[{"line_number":25,"context_line":""},{"line_number":26,"context_line":"    :param request_body_schema: a schema to validate the resource reference"},{"line_number":27,"context_line":"    :param resource_to_validate: the reference to validate"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"    \"\"\""},{"line_number":30,"context_line":"    schema_validator \u003d validators.SchemaValidator(request_body_schema)"},{"line_number":31,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"3a50d1a3_fd38d5a1","line":28,"in_reply_to":"3a50d1a3_baad7385","updated":"2015-07-29 17:31:18.000000000","message":"The format for exceptions is here: http://sphinx-doc.org/domains.html#info-field-lists\n\n :raises keystone.exception.ValidationError: \u003ccondition\u003e","commit_id":"4e9b006b911111dec6c29efbb1ec4c496c1cde80"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"a27c0fd5af595a575dcddc2865d75b389b8b2de1","unresolved":false,"context_lines":[{"line_number":25,"context_line":""},{"line_number":26,"context_line":"    :param request_body_schema: a schema to validate the resource reference"},{"line_number":27,"context_line":"    :param resource_to_validate: the reference to validate"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"    \"\"\""},{"line_number":30,"context_line":"    schema_validator \u003d validators.SchemaValidator(request_body_schema)"},{"line_number":31,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"3a50d1a3_9172c6e2","line":28,"in_reply_to":"3a50d1a3_fd38d5a1","updated":"2015-07-30 02:49:19.000000000","message":"Done","commit_id":"4e9b006b911111dec6c29efbb1ec4c496c1cde80"},{"author":{"_account_id":4,"name":"Dolph Mathews","email":"dolph.mathews@gmail.com","username":"dolph"},"change_message_id":"499a06da57a890dcaf575717835ac21159fe2e35","unresolved":false,"context_lines":[{"line_number":31,"context_line":"    def add_validator(func):"},{"line_number":32,"context_line":"        @functools.wraps(func)"},{"line_number":33,"context_line":"        def wrapper(*args, **kwargs):"},{"line_number":34,"context_line":"            if resource_to_validate in kwargs:"},{"line_number":35,"context_line":"                schema_validator.validate(kwargs[resource_to_validate])"},{"line_number":36,"context_line":"            return func(*args, **kwargs)"},{"line_number":37,"context_line":"        return wrapper"}],"source_content_type":"text/x-python","patch_set":17,"id":"1a4dcd0f_fc399342","side":"PARENT","line":34,"updated":"2015-08-03 20:53:24.000000000","message":"simplify with this","commit_id":"06b8f2fcf634e3e5a85ba95642172b8e93012460"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"0b3c06d71463b563cbf2e96dda7dd54db9758deb","unresolved":false,"context_lines":[{"line_number":31,"context_line":"    def add_validator(func):"},{"line_number":32,"context_line":"        @functools.wraps(func)"},{"line_number":33,"context_line":"        def wrapper(*args, **kwargs):"},{"line_number":34,"context_line":"            if resource_to_validate in kwargs:"},{"line_number":35,"context_line":"                schema_validator.validate(kwargs[resource_to_validate])"},{"line_number":36,"context_line":"            return func(*args, **kwargs)"},{"line_number":37,"context_line":"        return wrapper"}],"source_content_type":"text/x-python","patch_set":17,"id":"1a4dcd0f_3f128363","side":"PARENT","line":34,"in_reply_to":"1a4dcd0f_fc399342","updated":"2015-08-04 03:43:09.000000000","message":"Done","commit_id":"06b8f2fcf634e3e5a85ba95642172b8e93012460"},{"author":{"_account_id":4,"name":"Dolph Mathews","email":"dolph.mathews@gmail.com","username":"dolph"},"change_message_id":"499a06da57a890dcaf575717835ac21159fe2e35","unresolved":false,"context_lines":[{"line_number":27,"context_line":"    :param resource_to_validate: the reference to validate"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"    :raises keystone.exception.ValidationError: when resource_to_validate is"},{"line_number":30,"context_line":"            not passed in or passed with an empty value."},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"    \"\"\""},{"line_number":33,"context_line":"    schema_validator \u003d validators.SchemaValidator(request_body_schema)"}],"source_content_type":"text/x-python","patch_set":17,"id":"1a4dcd0f_5cdbe71b","line":30,"updated":"2015-08-03 20:53:24.000000000","message":"how can it not be passed in? it\u0027s a required argument.","commit_id":"7c66932b2ed1a32224ee1fb129cca24bfbdc3d16"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"5892abd5f3ae4b026534d506ed26499163d4d128","unresolved":false,"context_lines":[{"line_number":27,"context_line":"    :param resource_to_validate: the reference to validate"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"    :raises keystone.exception.ValidationError: when resource_to_validate is"},{"line_number":30,"context_line":"            not passed in or passed with an empty value."},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"    \"\"\""},{"line_number":33,"context_line":"    schema_validator \u003d validators.SchemaValidator(request_body_schema)"}],"source_content_type":"text/x-python","patch_set":17,"id":"1a4dcd0f_e5cb3371","line":30,"in_reply_to":"1a4dcd0f_5cdbe71b","updated":"2015-08-04 01:20:36.000000000","message":"@Dolph, actually, the docstring here means resource_to_validate is not existing in the kwargs...","commit_id":"7c66932b2ed1a32224ee1fb129cca24bfbdc3d16"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"0b3c06d71463b563cbf2e96dda7dd54db9758deb","unresolved":false,"context_lines":[{"line_number":27,"context_line":"    :param resource_to_validate: the reference to validate"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"    :raises keystone.exception.ValidationError: when resource_to_validate is"},{"line_number":30,"context_line":"            not passed in or passed with an empty value."},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"    \"\"\""},{"line_number":33,"context_line":"    schema_validator \u003d validators.SchemaValidator(request_body_schema)"}],"source_content_type":"text/x-python","patch_set":17,"id":"1a4dcd0f_9f1dd775","line":30,"in_reply_to":"1a4dcd0f_5cdbe71b","updated":"2015-08-04 03:43:09.000000000","message":"Done","commit_id":"7c66932b2ed1a32224ee1fb129cca24bfbdc3d16"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"5892abd5f3ae4b026534d506ed26499163d4d128","unresolved":false,"context_lines":[{"line_number":34,"context_line":""},{"line_number":35,"context_line":"    def add_validator(func):"},{"line_number":36,"context_line":"        @functools.wraps(func)"},{"line_number":37,"context_line":"        def wrapper(*args, **kwargs):"},{"line_number":38,"context_line":"            if not kwargs.get(resource_to_validate):"},{"line_number":39,"context_line":"                raise exception.ValidationError(attribute\u003dresource_to_validate,"},{"line_number":40,"context_line":"                                                target\u003d\u0027request body\u0027)"}],"source_content_type":"text/x-python","patch_set":17,"id":"1a4dcd0f_658de330","line":37,"updated":"2015-08-04 01:20:36.000000000","message":"... from here, I happened to update the docstring and move the comments here up to the docstring from the previous patch.\n\nI will revert it back, thanks!","commit_id":"7c66932b2ed1a32224ee1fb129cca24bfbdc3d16"},{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"3928edf822a69d861017a2bd94afd2d7e98c1030","unresolved":false,"context_lines":[{"line_number":27,"context_line":""},{"line_number":28,"context_line":"    :param request_body_schema: a schema to validate the resource reference"},{"line_number":29,"context_line":"    :param resource_to_validate: the reference to validate"},{"line_number":30,"context_line":"    :raises keystone.exception.ValidationError: Raises if"},{"line_number":31,"context_line":"            `resource_to_validate` is not passed by or passed with an empty"},{"line_number":32,"context_line":"            value (see wrapper method below)."},{"line_number":33,"context_line":"    :raises TypeError: at decoration time when the expected resource to"}],"source_content_type":"text/x-python","patch_set":22,"id":"1a4dcd0f_c8e93981","line":30,"updated":"2015-08-15 12:04:30.000000000","message":"(nit) Remove the word \u0027Raises\u0027 here. I think this makes the docs flow better. See http://docs-draft.openstack.org/03/195903/22/check/gate-keystone-docs/704843d//doc/build/html/api/keystone.common.validation.html#keystone.common.validation.validated for my raises vs. yours.","commit_id":"f8135b39315eb14bfc8a210dc49e0ebd92f3f45d"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"869676b9c0fec43816fbe7f789eac6607195b724","unresolved":false,"context_lines":[{"line_number":27,"context_line":""},{"line_number":28,"context_line":"    :param request_body_schema: a schema to validate the resource reference"},{"line_number":29,"context_line":"    :param resource_to_validate: the reference to validate"},{"line_number":30,"context_line":"    :raises keystone.exception.ValidationError: Raises if"},{"line_number":31,"context_line":"            `resource_to_validate` is not passed by or passed with an empty"},{"line_number":32,"context_line":"            value (see wrapper method below)."},{"line_number":33,"context_line":"    :raises TypeError: at decoration time when the expected resource to"}],"source_content_type":"text/x-python","patch_set":22,"id":"1a4dcd0f_0b9ddbba","line":30,"in_reply_to":"1a4dcd0f_c8e93981","updated":"2015-08-15 13:07:55.000000000","message":"Done","commit_id":"f8135b39315eb14bfc8a210dc49e0ebd92f3f45d"},{"author":{"_account_id":5707,"name":"Henry Nash","email":"henryn@linux.vnet.ibm.com","username":"henry-nash"},"change_message_id":"cf6636a7fc658dc578dc369f00cf03612dab2100","unresolved":false,"context_lines":[{"line_number":63,"context_line":"                        raise exception.ValidationError("},{"line_number":64,"context_line":"                            attribute\u003dresource_to_validate,"},{"line_number":65,"context_line":"                            target\u003d\u0027request body\u0027)"},{"line_number":66,"context_line":"                # We cannot find the resource neither from kwargs nor args."},{"line_number":67,"context_line":"                except IndexError:"},{"line_number":68,"context_line":"                    raise exception.ValidationError("},{"line_number":69,"context_line":"                        attribute\u003dresource_to_validate,"}],"source_content_type":"text/x-python","patch_set":22,"id":"1a4dcd0f_25e6c844","line":66,"updated":"2015-08-15 08:35:32.000000000","message":"can this really happen?  Wouldn\u0027t a TypeError have been thrown when we first inspected the signature?","commit_id":"f8135b39315eb14bfc8a210dc49e0ebd92f3f45d"},{"author":{"_account_id":5707,"name":"Henry Nash","email":"henryn@linux.vnet.ibm.com","username":"henry-nash"},"change_message_id":"ad8b8ee37d5e96da7c7ba03b8c844e763b9e8ebd","unresolved":false,"context_lines":[{"line_number":63,"context_line":"                        raise exception.ValidationError("},{"line_number":64,"context_line":"                            attribute\u003dresource_to_validate,"},{"line_number":65,"context_line":"                            target\u003d\u0027request body\u0027)"},{"line_number":66,"context_line":"                # We cannot find the resource neither from kwargs nor args."},{"line_number":67,"context_line":"                except IndexError:"},{"line_number":68,"context_line":"                    raise exception.ValidationError("},{"line_number":69,"context_line":"                        attribute\u003dresource_to_validate,"}],"source_content_type":"text/x-python","patch_set":22,"id":"1a4dcd0f_88fc9140","line":66,"in_reply_to":"1a4dcd0f_08c96125","updated":"2015-08-15 12:08:45.000000000","message":"Oh, sorry, bad positioning of question...I meant the IndexError below....","commit_id":"f8135b39315eb14bfc8a210dc49e0ebd92f3f45d"},{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"3928edf822a69d861017a2bd94afd2d7e98c1030","unresolved":false,"context_lines":[{"line_number":63,"context_line":"                        raise exception.ValidationError("},{"line_number":64,"context_line":"                            attribute\u003dresource_to_validate,"},{"line_number":65,"context_line":"                            target\u003d\u0027request body\u0027)"},{"line_number":66,"context_line":"                # We cannot find the resource neither from kwargs nor args."},{"line_number":67,"context_line":"                except IndexError:"},{"line_number":68,"context_line":"                    raise exception.ValidationError("},{"line_number":69,"context_line":"                        attribute\u003dresource_to_validate,"}],"source_content_type":"text/x-python","patch_set":22,"id":"1a4dcd0f_08c96125","line":66,"in_reply_to":"1a4dcd0f_25e6c844","updated":"2015-08-15 12:04:30.000000000","message":"The TypeError I raise when inspecting is a import (compile) type error. It will happen when the decorator is first evaluated when the module is imported. This error is what happens when the caller doesn\u0027t provide a value for the argument.","commit_id":"f8135b39315eb14bfc8a210dc49e0ebd92f3f45d"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"94a2dcdada0ed1cee78ba5d9a3a8285391b9afd2","unresolved":false,"context_lines":[{"line_number":63,"context_line":"                        raise exception.ValidationError("},{"line_number":64,"context_line":"                            attribute\u003dresource_to_validate,"},{"line_number":65,"context_line":"                            target\u003d\u0027request body\u0027)"},{"line_number":66,"context_line":"                # We cannot find the resource neither from kwargs nor args."},{"line_number":67,"context_line":"                except IndexError:"},{"line_number":68,"context_line":"                    raise exception.ValidationError("},{"line_number":69,"context_line":"                        attribute\u003dresource_to_validate,"}],"source_content_type":"text/x-python","patch_set":22,"id":"1a4dcd0f_2861bdd3","line":66,"in_reply_to":"1a4dcd0f_25e6c844","updated":"2015-08-15 10:39:25.000000000","message":"yes, this can happen and this is what\u0027s the bug for.\n\n`inspect` just inspect the signature but not guarantee the argument has the value.\n\nfor example, the method as this,\n@validated(\u0027entity\u0027)\ndef do_something(entity):\n pass\n \n`inspect` could help to get the signature as this,\nArgSpec(args\u003d[\u0027entity\u0027], varargs\u003dNone, keywords\u003dNone, defaults\u003dNone)\n\nbut whether there is a value for the argument \"entity\" is not depend on the signature but how this method was called.\n\npls see the testcase, it will be more clear.","commit_id":"f8135b39315eb14bfc8a210dc49e0ebd92f3f45d"},{"author":{"_account_id":5707,"name":"Henry Nash","email":"henryn@linux.vnet.ibm.com","username":"henry-nash"},"change_message_id":"bb90eb2225ab89fd20afc581549291a179cf8c0a","unresolved":false,"context_lines":[{"line_number":63,"context_line":"                        raise exception.ValidationError("},{"line_number":64,"context_line":"                            attribute\u003dresource_to_validate,"},{"line_number":65,"context_line":"                            target\u003d\u0027request body\u0027)"},{"line_number":66,"context_line":"                # We cannot find the resource neither from kwargs nor args."},{"line_number":67,"context_line":"                except IndexError:"},{"line_number":68,"context_line":"                    raise exception.ValidationError("},{"line_number":69,"context_line":"                        attribute\u003dresource_to_validate,"}],"source_content_type":"text/x-python","patch_set":22,"id":"1a4dcd0f_e82f55a5","line":66,"in_reply_to":"1a4dcd0f_88fc9140","updated":"2015-08-15 12:25:11.000000000","message":"ok, thanks to stank explaining it to me on IRC, I get it!","commit_id":"f8135b39315eb14bfc8a210dc49e0ebd92f3f45d"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"869676b9c0fec43816fbe7f789eac6607195b724","unresolved":false,"context_lines":[{"line_number":63,"context_line":"                        raise exception.ValidationError("},{"line_number":64,"context_line":"                            attribute\u003dresource_to_validate,"},{"line_number":65,"context_line":"                            target\u003d\u0027request body\u0027)"},{"line_number":66,"context_line":"                # We cannot find the resource neither from kwargs nor args."},{"line_number":67,"context_line":"                except IndexError:"},{"line_number":68,"context_line":"                    raise exception.ValidationError("},{"line_number":69,"context_line":"                        attribute\u003dresource_to_validate,"}],"source_content_type":"text/x-python","patch_set":22,"id":"1a4dcd0f_cba6130f","line":66,"in_reply_to":"1a4dcd0f_e82f55a5","updated":"2015-08-15 13:07:55.000000000","message":"Thanks!","commit_id":"f8135b39315eb14bfc8a210dc49e0ebd92f3f45d"},{"author":{"_account_id":6482,"name":"Steve Martinelli","email":"s.martinelli@gmail.com","username":"stevemar"},"change_message_id":"a4db9a45940f129048f97b3cfb81d0dea2d9bd32","unresolved":false,"context_lines":[{"line_number":49,"context_line":""},{"line_number":50,"context_line":"        @functools.wraps(func)"},{"line_number":51,"context_line":"        def wrapper(*args, **kwargs):"},{"line_number":52,"context_line":"            if kwargs.get(resource_to_validate):"},{"line_number":53,"context_line":"                schema_validator.validate(kwargs[resource_to_validate])"},{"line_number":54,"context_line":"            else:"},{"line_number":55,"context_line":"                try:"}],"source_content_type":"text/x-python","patch_set":23,"id":"fa1b9901_0c751cca","line":52,"updated":"2015-08-18 06:21:55.000000000","message":"did this need to change?","commit_id":"d270e8757d0142dfd87100e6f05e5488e784c6e2"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"a23f9f2ac554e08353191efe85998200e67e9a2e","unresolved":false,"context_lines":[{"line_number":49,"context_line":""},{"line_number":50,"context_line":"        @functools.wraps(func)"},{"line_number":51,"context_line":"        def wrapper(*args, **kwargs):"},{"line_number":52,"context_line":"            if kwargs.get(resource_to_validate):"},{"line_number":53,"context_line":"                schema_validator.validate(kwargs[resource_to_validate])"},{"line_number":54,"context_line":"            else:"},{"line_number":55,"context_line":"                try:"}],"source_content_type":"text/x-python","patch_set":23,"id":"fa1b9901_8a5829fc","line":52,"in_reply_to":"fa1b9901_0c751cca","updated":"2015-08-18 08:28:23.000000000","message":"Steve, this change is needed since we should exclude the case when the \u0027resource_to_validate\u0027 existing in kwargs but is an empty value.\n\n\u003e\u003e\u003e kwargs \u003d {\"key\": \u0027\u0027}\n\n\u003e\u003e\u003e \u0027key\u0027 in kwargs\nTrue\n\nIn this case, we won\u0027t let it go to jsonschema just beacuse the error message thrown by jsonschema doesn\u0027t help.\n\nThis is part of scope from that bug.","commit_id":"d270e8757d0142dfd87100e6f05e5488e784c6e2"}],"keystone/resource/controllers.py":[{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"1db1a7a6bfab2dc30882e7bb1ec00b07f9cab393","unresolved":false,"context_lines":[{"line_number":198,"context_line":""},{"line_number":199,"context_line":"    @controller.protected()"},{"line_number":200,"context_line":"    @validation.validated(schema.project_create, \u0027project\u0027)"},{"line_number":201,"context_line":"    def create_project(self, context, project\u003dNone):"},{"line_number":202,"context_line":"        if not project:"},{"line_number":203,"context_line":"            raise exception.ValidationError(attribute\u003d\u0027project\u0027,"},{"line_number":204,"context_line":"                                            target\u003d\u0027request body\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba3cc151_1c59c68e","line":201,"updated":"2015-07-06 14:12:58.000000000","message":"Why isn\u0027t the validation already raising an error here?","commit_id":"45409fe667a1a34d7feb0489f2a471fd44798487"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"3528df4502d22d2b34a257fb48e99a325646e361","unresolved":false,"context_lines":[{"line_number":198,"context_line":""},{"line_number":199,"context_line":"    @controller.protected()"},{"line_number":200,"context_line":"    @validation.validated(schema.project_create, \u0027project\u0027)"},{"line_number":201,"context_line":"    def create_project(self, context, project\u003dNone):"},{"line_number":202,"context_line":"        if not project:"},{"line_number":203,"context_line":"            raise exception.ValidationError(attribute\u003d\u0027project\u0027,"},{"line_number":204,"context_line":"                                            target\u003d\u0027request body\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba3cc151_6d813e4d","line":201,"in_reply_to":"ba3cc151_1c59c68e","updated":"2015-07-06 15:00:38.000000000","message":"As we discussed in the irc, this is skipped in the validation if there is no request body.\n\nIf we change the logic in the validation, remove \"if\" and use .get() we still cannot know what\u0027s is missing but just \"no enough properties...\" error message throw out by the lib of jsonschema.\nmethod: def validate(...) is a general method, so we cannot customize the error message for a specific entity, like \u0027project\u0027.","commit_id":"45409fe667a1a34d7feb0489f2a471fd44798487"},{"author":{"_account_id":6486,"name":"Brant Knudson","email":"blk@acm.org","username":"blk-u"},"change_message_id":"f4de865dda90a6c169afe1c244e326d37ea879bd","unresolved":false,"context_lines":[{"line_number":198,"context_line":""},{"line_number":199,"context_line":"    @controller.protected()"},{"line_number":200,"context_line":"    @validation.validated(schema.project_create, \u0027project\u0027)"},{"line_number":201,"context_line":"    def create_project(self, context, project\u003dNone):"},{"line_number":202,"context_line":"        if not project:"},{"line_number":203,"context_line":"            raise exception.ValidationError(attribute\u003d\u0027project\u0027,"},{"line_number":204,"context_line":"                                            target\u003d\u0027request body\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba3cc151_8cecaff4","line":201,"in_reply_to":"ba3cc151_6d813e4d","updated":"2015-07-06 22:57:50.000000000","message":"change validation to have an option to require request body.","commit_id":"45409fe667a1a34d7feb0489f2a471fd44798487"},{"author":{"_account_id":13055,"name":"Alexander Makarov","email":"ajiekcahdp.makapob@gmail.com","username":"amakarov"},"change_message_id":"cbf6d44e83ad51f8331a318db170445570ab8bc2","unresolved":false,"context_lines":[{"line_number":272,"context_line":"    @controller.protected()"},{"line_number":273,"context_line":"    @validation.validated(schema.project_update, \u0027project\u0027)"},{"line_number":274,"context_line":"    def update_project(self, context, project_id, project\u003dNone):"},{"line_number":275,"context_line":"        if not project:"},{"line_number":276,"context_line":"            raise exception.ValidationError(attribute\u003d\u0027project\u0027,"},{"line_number":277,"context_line":"                                            target\u003d\u0027request body\u0027)"},{"line_number":278,"context_line":"        self._require_matching_id(project_id, project)"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba3cc151_f24a0927","line":275,"updated":"2015-07-06 14:39:31.000000000","message":"Please provide a test when this condition is met.","commit_id":"45409fe667a1a34d7feb0489f2a471fd44798487"},{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"e0c13a0ece71f761d68c8db7b5139421bc77534d","unresolved":false,"context_lines":[{"line_number":272,"context_line":"    @controller.protected()"},{"line_number":273,"context_line":"    @validation.validated(schema.project_update, \u0027project\u0027)"},{"line_number":274,"context_line":"    def update_project(self, context, project_id, project\u003dNone):"},{"line_number":275,"context_line":"        if not project:"},{"line_number":276,"context_line":"            raise exception.ValidationError(attribute\u003d\u0027project\u0027,"},{"line_number":277,"context_line":"                                            target\u003d\u0027request body\u0027)"},{"line_number":278,"context_line":"        self._require_matching_id(project_id, project)"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba3cc151_31694c8c","line":275,"in_reply_to":"ba3cc151_48ba2870","updated":"2015-07-06 15:39:18.000000000","message":"I\u0027ll post an alternative patch that shows how this can be done in the validation. This doesn\u0027t belong here.","commit_id":"45409fe667a1a34d7feb0489f2a471fd44798487"},{"author":{"_account_id":13055,"name":"Alexander Makarov","email":"ajiekcahdp.makapob@gmail.com","username":"amakarov"},"change_message_id":"b06e35355535e62b2fad14079e2b95cf591b6dae","unresolved":false,"context_lines":[{"line_number":272,"context_line":"    @controller.protected()"},{"line_number":273,"context_line":"    @validation.validated(schema.project_update, \u0027project\u0027)"},{"line_number":274,"context_line":"    def update_project(self, context, project_id, project\u003dNone):"},{"line_number":275,"context_line":"        if not project:"},{"line_number":276,"context_line":"            raise exception.ValidationError(attribute\u003d\u0027project\u0027,"},{"line_number":277,"context_line":"                                            target\u003d\u0027request body\u0027)"},{"line_number":278,"context_line":"        self._require_matching_id(project_id, project)"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba3cc151_ed246ec7","line":275,"in_reply_to":"ba3cc151_6dcffeb3","updated":"2015-07-06 15:05:52.000000000","message":"Maybe correct schema validation then?","commit_id":"45409fe667a1a34d7feb0489f2a471fd44798487"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"c1e69ba595720c4cf3cf11866169415fb8ce3c8c","unresolved":false,"context_lines":[{"line_number":272,"context_line":"    @controller.protected()"},{"line_number":273,"context_line":"    @validation.validated(schema.project_update, \u0027project\u0027)"},{"line_number":274,"context_line":"    def update_project(self, context, project_id, project\u003dNone):"},{"line_number":275,"context_line":"        if not project:"},{"line_number":276,"context_line":"            raise exception.ValidationError(attribute\u003d\u0027project\u0027,"},{"line_number":277,"context_line":"                                            target\u003d\u0027request body\u0027)"},{"line_number":278,"context_line":"        self._require_matching_id(project_id, project)"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba3cc151_48ba2870","line":275,"in_reply_to":"ba3cc151_ed246ec7","updated":"2015-07-06 15:17:08.000000000","message":"pls see my reply to David, L201 in this patch.","commit_id":"45409fe667a1a34d7feb0489f2a471fd44798487"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"3528df4502d22d2b34a257fb48e99a325646e361","unresolved":false,"context_lines":[{"line_number":272,"context_line":"    @controller.protected()"},{"line_number":273,"context_line":"    @validation.validated(schema.project_update, \u0027project\u0027)"},{"line_number":274,"context_line":"    def update_project(self, context, project_id, project\u003dNone):"},{"line_number":275,"context_line":"        if not project:"},{"line_number":276,"context_line":"            raise exception.ValidationError(attribute\u003d\u0027project\u0027,"},{"line_number":277,"context_line":"                                            target\u003d\u0027request body\u0027)"},{"line_number":278,"context_line":"        self._require_matching_id(project_id, project)"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba3cc151_6dcffeb3","line":275,"in_reply_to":"ba3cc151_f24a0927","updated":"2015-07-06 15:00:38.000000000","message":"the testcase is already provided, pls check it, see test_create_project_no_request_body and test_create_project_empty_request_body","commit_id":"45409fe667a1a34d7feb0489f2a471fd44798487"}],"keystone/tests/unit/test_v3_assignment.py":[{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"1db1a7a6bfab2dc30882e7bb1ec00b07f9cab393","unresolved":false,"context_lines":[{"line_number":613,"context_line":"        self.new_project_ref(domain_id\u003duuid.uuid4().hex)"},{"line_number":614,"context_line":"        self.post(\u0027/projects\u0027, body\u003d{\u0027project\u0027: {}}, expected_status\u003d400)"},{"line_number":615,"context_line":""},{"line_number":616,"context_line":"    def test_create_project_no_request_body(self):"},{"line_number":617,"context_line":"        \"\"\"Expecting to see useful info when request body is not provided.\"\"\""},{"line_number":618,"context_line":"        self.controller \u003d resource.controllers.ProjectV3()"},{"line_number":619,"context_line":"        e \u003d self.assertRaises(exception.ValidationError,"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba3cc151_3c028a70","line":616,"updated":"2015-07-06 14:12:58.000000000","message":"Since these tests are not restful test cases they don\u0027t belong in this test class. Maybe a better place would be something in keystone.tests.unit.resource or something like that.","commit_id":"45409fe667a1a34d7feb0489f2a471fd44798487"},{"author":{"_account_id":6486,"name":"Brant Knudson","email":"blk@acm.org","username":"blk-u"},"change_message_id":"233eb92a48d50af5b47261c7c1751eb11e159afe","unresolved":false,"context_lines":[{"line_number":613,"context_line":"        self.new_project_ref(domain_id\u003duuid.uuid4().hex)"},{"line_number":614,"context_line":"        self.post(\u0027/projects\u0027, body\u003d{\u0027project\u0027: {}}, expected_status\u003d400)"},{"line_number":615,"context_line":""},{"line_number":616,"context_line":"    def test_create_project_no_request_body(self):"},{"line_number":617,"context_line":"        \"\"\"Expecting to see useful info when request body is not provided.\"\"\""},{"line_number":618,"context_line":"        self.controller \u003d resource.controllers.ProjectV3()"},{"line_number":619,"context_line":"        e \u003d self.assertRaises(exception.ValidationError,"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba3cc151_0c9c1f5c","line":616,"in_reply_to":"ba3cc151_0e76693e","updated":"2015-07-06 23:01:05.000000000","message":"create a new test class in keystone.tests.unit.resource.controllers","commit_id":"45409fe667a1a34d7feb0489f2a471fd44798487"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"a759c76d907e569b77f464b05db1de0f2d2762a3","unresolved":false,"context_lines":[{"line_number":613,"context_line":"        self.new_project_ref(domain_id\u003duuid.uuid4().hex)"},{"line_number":614,"context_line":"        self.post(\u0027/projects\u0027, body\u003d{\u0027project\u0027: {}}, expected_status\u003d400)"},{"line_number":615,"context_line":""},{"line_number":616,"context_line":"    def test_create_project_no_request_body(self):"},{"line_number":617,"context_line":"        \"\"\"Expecting to see useful info when request body is not provided.\"\"\""},{"line_number":618,"context_line":"        self.controller \u003d resource.controllers.ProjectV3()"},{"line_number":619,"context_line":"        e \u003d self.assertRaises(exception.ValidationError,"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba3cc151_0e76693e","line":616,"in_reply_to":"ba3cc151_3c028a70","updated":"2015-07-06 15:29:37.000000000","message":"Tried but no found any place which is better to accommodate this kind of testcase. Only difference here is these testcases is not restful testcase but this is not exclude explicitly by the name of this file.\n\nAny other concerns for these testcase?","commit_id":"45409fe667a1a34d7feb0489f2a471fd44798487"}],"keystone/tests/unit/test_validation.py":[{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"891b2a7847f7b882ab279a91e10697054e41951c","unresolved":false,"context_lines":[{"line_number":113,"context_line":"        e \u003d self.assertRaises(exception.ValidationError,"},{"line_number":114,"context_line":"                              self.create_entity)"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"        # explicitly verify that the error message shows that *entity* is"},{"line_number":117,"context_line":"        # not in the request body."},{"line_number":118,"context_line":"        self.assertIn(\u0027Expecting to find entity in request body\u0027,"},{"line_number":119,"context_line":"                      six.text_type(e))"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a41bdd9_973b5cd1","line":116,"updated":"2015-07-13 12:14:02.000000000","message":"(nit) i think these comments in all of the methods are overkill. the methods docstring is enough to say what is happening.","commit_id":"4e57a98a0ee5bb3f55252c0d61b3b234fd0a73bf"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"3235208072ad5edf863f2c222d6612e0aa6ab409","unresolved":false,"context_lines":[{"line_number":113,"context_line":"        e \u003d self.assertRaises(exception.ValidationError,"},{"line_number":114,"context_line":"                              self.create_entity)"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"        # explicitly verify that the error message shows that *entity* is"},{"line_number":117,"context_line":"        # not in the request body."},{"line_number":118,"context_line":"        self.assertIn(\u0027Expecting to find entity in request body\u0027,"},{"line_number":119,"context_line":"                      six.text_type(e))"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a41bdd9_397d716e","line":116,"in_reply_to":"9a41bdd9_973b5cd1","updated":"2015-07-14 09:51:54.000000000","message":"Done","commit_id":"4e57a98a0ee5bb3f55252c0d61b3b234fd0a73bf"},{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"891b2a7847f7b882ab279a91e10697054e41951c","unresolved":false,"context_lines":[{"line_number":142,"context_line":""},{"line_number":143,"context_line":"    def test_update_entity_empty_request_body_with_decorator(self):"},{"line_number":144,"context_line":"        \"\"\"Test the case when client passing in an empty entity reference.\"\"\""},{"line_number":145,"context_line":"        e \u003d self.assertRaises(exception.ValidationError,"},{"line_number":146,"context_line":"                              self.create_entity,"},{"line_number":147,"context_line":"                              uuid.uuid4().hex,"},{"line_number":148,"context_line":"                              entity\u003d{})"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a41bdd9_d7ca44a1","line":145,"updated":"2015-07-13 12:14:02.000000000","message":"(nit) since the methods are virtually identical you can probably do something like:\n\n  def _assert_entity_fails(self, entity):\n      e \u003d ...\n      self.assertIn(...)\n\nand call it from your methods using:\n\n  self._assert_entity_fails({})","commit_id":"4e57a98a0ee5bb3f55252c0d61b3b234fd0a73bf"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"50a0bc4a5ef470f800425b5555558b393e867065","unresolved":false,"context_lines":[{"line_number":142,"context_line":""},{"line_number":143,"context_line":"    def test_update_entity_empty_request_body_with_decorator(self):"},{"line_number":144,"context_line":"        \"\"\"Test the case when client passing in an empty entity reference.\"\"\""},{"line_number":145,"context_line":"        e \u003d self.assertRaises(exception.ValidationError,"},{"line_number":146,"context_line":"                              self.create_entity,"},{"line_number":147,"context_line":"                              uuid.uuid4().hex,"},{"line_number":148,"context_line":"                              entity\u003d{})"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a41bdd9_0146fdbe","line":145,"in_reply_to":"9a41bdd9_d7ca44a1","updated":"2015-07-14 08:13:57.000000000","message":"@David, thanks for the comments here, If another commit is needed I will address them, or address them in the separate patch if this patch would got merging.","commit_id":"4e57a98a0ee5bb3f55252c0d61b3b234fd0a73bf"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"3235208072ad5edf863f2c222d6612e0aa6ab409","unresolved":false,"context_lines":[{"line_number":142,"context_line":""},{"line_number":143,"context_line":"    def test_update_entity_empty_request_body_with_decorator(self):"},{"line_number":144,"context_line":"        \"\"\"Test the case when client passing in an empty entity reference.\"\"\""},{"line_number":145,"context_line":"        e \u003d self.assertRaises(exception.ValidationError,"},{"line_number":146,"context_line":"                              self.create_entity,"},{"line_number":147,"context_line":"                              uuid.uuid4().hex,"},{"line_number":148,"context_line":"                              entity\u003d{})"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a41bdd9_f997098e","line":145,"in_reply_to":"9a41bdd9_d7ca44a1","updated":"2015-07-14 09:51:54.000000000","message":"Done","commit_id":"4e57a98a0ee5bb3f55252c0d61b3b234fd0a73bf"},{"author":{"_account_id":5707,"name":"Henry Nash","email":"henryn@linux.vnet.ibm.com","username":"henry-nash"},"change_message_id":"1f55dd03e00cb21e55e26c6619baf11af05a3465","unresolved":false,"context_lines":[{"line_number":316,"context_line":"                               \u0027email\u0027: \u0027some invalid email value\u0027}"},{"line_number":317,"context_line":"        # request body passed as positional argument will be caught by"},{"line_number":318,"context_line":"        # validation, thus, ValidationError exception will be raised"},{"line_number":319,"context_line":"        # by the validation."},{"line_number":320,"context_line":"        self.assertRaises(exception.ValidationError,"},{"line_number":321,"context_line":"                          self.create_entity_with_id_args,"},{"line_number":322,"context_line":"                          uuid.uuid4().hex,"}],"source_content_type":"text/x-python","patch_set":12,"id":"9a41bdd9_f5c9d226","line":319,"updated":"2015-07-16 09:53:14.000000000","message":"...so is this satisfying the TODO above...or is that  separate problem?","commit_id":"7854f9950c8ece189731a7aa6a1ea9ac04ca25cf"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"bc39b7ec51ed65b324290a8590468e6be5348670","unresolved":false,"context_lines":[{"line_number":316,"context_line":"                               \u0027email\u0027: \u0027some invalid email value\u0027}"},{"line_number":317,"context_line":"        # request body passed as positional argument will be caught by"},{"line_number":318,"context_line":"        # validation, thus, ValidationError exception will be raised"},{"line_number":319,"context_line":"        # by the validation."},{"line_number":320,"context_line":"        self.assertRaises(exception.ValidationError,"},{"line_number":321,"context_line":"                          self.create_entity_with_id_args,"},{"line_number":322,"context_line":"                          uuid.uuid4().hex,"}],"source_content_type":"text/x-python","patch_set":12,"id":"9a41bdd9_4170fb3f","line":319,"in_reply_to":"9a41bdd9_f5c9d226","updated":"2015-07-16 12:27:15.000000000","message":"Henry, right, these comments are saying different things.\n\nTODO above mean only dict passed will be recoginized by the validation, so the schema validation will be missed if we haven\u0027t passed the request body as dict.\n\nThe comments here just want to explain why we need to update the testcase to raise the exception.  The reason is the change in  `common.validation.__init__.py` in this patch will detect that the **kwargs is None, so it will raise the exception instead of let it simply pass the validation. Thus, this doesn\u0027t mean we address the TODO above. I add this comments in order to not make the change here looks surprise.\n\nI know this is a little bit obscured, but hope the explaination here make it more clear.\n\n\nRegards.","commit_id":"7854f9950c8ece189731a7aa6a1ea9ac04ca25cf"},{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"4dd3092b86a321335e4c42bfa079d54b4a58b279","unresolved":false,"context_lines":[{"line_number":127,"context_line":"    def update_entity(self, entity_id, entity):"},{"line_number":128,"context_line":"        pass"},{"line_number":129,"context_line":""},{"line_number":130,"context_line":"    def _assert_entity_fails(self, method, *args, **kwargs):"},{"line_number":131,"context_line":"        e \u003d self.assertRaises(exception.ValidationError, method,"},{"line_number":132,"context_line":"                              *args, **kwargs)"},{"line_number":133,"context_line":""}],"source_content_type":"text/x-python","patch_set":21,"id":"1a4dcd0f_c258445a","line":130,"updated":"2015-08-14 20:31:52.000000000","message":"(nit) I\u0027m not a fan of the name here since the entity isn\u0027t failing. It\u0027s the call to the method","commit_id":"8f8ba6fa093a9199c3d1d7d730693ed6da995f69"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"4194ec612922202b2fb8f15560ea5d5a16f81357","unresolved":false,"context_lines":[{"line_number":127,"context_line":"    def update_entity(self, entity_id, entity):"},{"line_number":128,"context_line":"        pass"},{"line_number":129,"context_line":""},{"line_number":130,"context_line":"    def _assert_entity_fails(self, method, *args, **kwargs):"},{"line_number":131,"context_line":"        e \u003d self.assertRaises(exception.ValidationError, method,"},{"line_number":132,"context_line":"                              *args, **kwargs)"},{"line_number":133,"context_line":""}],"source_content_type":"text/x-python","patch_set":21,"id":"1a4dcd0f_26433315","line":130,"in_reply_to":"1a4dcd0f_c258445a","updated":"2015-08-15 03:45:44.000000000","message":"Done","commit_id":"8f8ba6fa093a9199c3d1d7d730693ed6da995f69"}]}
