)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6659,"name":"Paul Michali","email":"pc@michali.net","username":"pcm"},"change_message_id":"798b53d4b17f6d34139037d28fbc369e6ebd59f1","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Elena Ezhova \u003ceezhova@mirantis.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2014-08-20 13:55:54 +0400"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Forbid regular users to reset admin-only attrs to default values"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"A regular user can reset an admin-only attribute to its default"},{"line_number":10,"context_line":"value due to the fact that a corresponding policy rule is"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":8,"id":"1abeadc6_977604a3","line":7,"updated":"2014-08-20 14:47:41.000000000","message":"nit:   to reset -\u003e from resetting","commit_id":"f1a1047756e5db2646eee4ca16c9e2092cba091d"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"4c15121913c2ca170804079a582b0ec26b3ef644","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Elena Ezhova \u003ceezhova@mirantis.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2014-08-20 13:55:54 +0400"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Forbid regular users to reset admin-only attrs to default values"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"A regular user can reset an admin-only attribute to its default"},{"line_number":10,"context_line":"value due to the fact that a corresponding policy rule is"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":8,"id":"1abeadc6_7085cd05","line":7,"in_reply_to":"1abeadc6_977604a3","updated":"2014-08-21 11:10:08.000000000","message":"Both forms are grammatically correct, but I prefer to use the infinitive form here since it is more imperative.","commit_id":"f1a1047756e5db2646eee4ca16c9e2092cba091d"},{"author":{"_account_id":6659,"name":"Paul Michali","email":"pc@michali.net","username":"pcm"},"change_message_id":"798b53d4b17f6d34139037d28fbc369e6ebd59f1","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"A regular user can reset an admin-only attribute to its default"},{"line_number":10,"context_line":"value due to the fact that a corresponding policy rule is"},{"line_number":11,"context_line":"enforced only in case when an attribute is present in the"},{"line_number":12,"context_line":"target AND has a non-default value."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Added a new attribute \"updated\" which contains a list of all"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":8,"id":"1abeadc6_5760ecce","line":11,"updated":"2014-08-20 14:47:41.000000000","message":"nit in case -\u003e in the case","commit_id":"f1a1047756e5db2646eee4ca16c9e2092cba091d"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"4c15121913c2ca170804079a582b0ec26b3ef644","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"A regular user can reset an admin-only attribute to its default"},{"line_number":10,"context_line":"value due to the fact that a corresponding policy rule is"},{"line_number":11,"context_line":"enforced only in case when an attribute is present in the"},{"line_number":12,"context_line":"target AND has a non-default value."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Added a new attribute \"updated\" which contains a list of all"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":8,"id":"1abeadc6_907d091f","line":11,"in_reply_to":"1abeadc6_5760ecce","updated":"2014-08-21 11:10:08.000000000","message":"Done","commit_id":"f1a1047756e5db2646eee4ca16c9e2092cba091d"},{"author":{"_account_id":6659,"name":"Paul Michali","email":"pc@michali.net","username":"pcm"},"change_message_id":"798b53d4b17f6d34139037d28fbc369e6ebd59f1","unresolved":false,"context_lines":[{"line_number":16,"context_line":"passed to policy.enforce."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"Changed a check for whether an attribute is explicitly set."},{"line_number":19,"context_line":"Now in case of update the function should not pay attention"},{"line_number":20,"context_line":"to a default value of an attribute, but check whether it was"},{"line_number":21,"context_line":"explicitly marked as being updated."},{"line_number":22,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":8,"id":"1abeadc6_17b11447","line":19,"updated":"2014-08-20 14:47:41.000000000","message":"nit:  Now in case -\u003e Now, in the case\n\nupdate -\u003e update,","commit_id":"f1a1047756e5db2646eee4ca16c9e2092cba091d"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"4c15121913c2ca170804079a582b0ec26b3ef644","unresolved":false,"context_lines":[{"line_number":16,"context_line":"passed to policy.enforce."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"Changed a check for whether an attribute is explicitly set."},{"line_number":19,"context_line":"Now in case of update the function should not pay attention"},{"line_number":20,"context_line":"to a default value of an attribute, but check whether it was"},{"line_number":21,"context_line":"explicitly marked as being updated."},{"line_number":22,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":8,"id":"1abeadc6_b07a0522","line":19,"in_reply_to":"1abeadc6_17b11447","updated":"2014-08-21 11:10:08.000000000","message":"Done","commit_id":"f1a1047756e5db2646eee4ca16c9e2092cba091d"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"276b12c87ebac450bce93b11fa9fc63e18d6b6a0","unresolved":false,"context_lines":[{"line_number":11,"context_line":"enforced only in the case when an attribute is present in the"},{"line_number":12,"context_line":"target AND has a non-default value."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Added a new attribute \"updated\" which contains a list of all"},{"line_number":15,"context_line":"to-be updated attributes to the body of the target that is"},{"line_number":16,"context_line":"passed to policy.enforce."},{"line_number":17,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":9,"id":"fa98f980_51a6b554","line":14,"range":{"start_line":14,"start_character":23,"end_line":14,"end_character":30},"updated":"2014-09-08 12:51:11.000000000","message":"\"marked_for_update\"?","commit_id":"ebff0efe0c2e05969c3bb0f8ef77585762ff2840"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"53b8cb14937da103df856de41d0f42da224f444c","unresolved":false,"context_lines":[{"line_number":11,"context_line":"enforced only in the case when an attribute is present in the"},{"line_number":12,"context_line":"target AND has a non-default value."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Added a new attribute \"updated\" which contains a list of all"},{"line_number":15,"context_line":"to-be updated attributes to the body of the target that is"},{"line_number":16,"context_line":"passed to policy.enforce."},{"line_number":17,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":9,"id":"fa98f980_e53c8795","line":14,"in_reply_to":"fa98f980_51a6b554","updated":"2014-09-15 05:35:59.000000000","message":"Thanks, that is a leftover from previous iterations.","commit_id":"ebff0efe0c2e05969c3bb0f8ef77585762ff2840"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"222a676767381fba0338fdbf1990505808a7702b","unresolved":false,"context_lines":[{"line_number":11,"context_line":"enforced only in the case when an attribute is present in the"},{"line_number":12,"context_line":"target AND has a non-default value."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Added a new attribute \"updated\" which contains a list of all"},{"line_number":15,"context_line":"to-be updated attributes to the body of the target that is"},{"line_number":16,"context_line":"passed to policy.enforce."},{"line_number":17,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":9,"id":"fa98f980_85757bfb","line":14,"in_reply_to":"fa98f980_e53c8795","updated":"2014-09-15 17:34:47.000000000","message":"Done","commit_id":"ebff0efe0c2e05969c3bb0f8ef77585762ff2840"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"a83c7e4e8e248ff7abbf62196e281e28fc6bf789","unresolved":false,"context_lines":[{"line_number":22,"context_line":""},{"line_number":23,"context_line":"Added unit-tests."},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"Closes-Bug: 1357379"},{"line_number":26,"context_line":"Related-Bug: 1338880"},{"line_number":27,"context_line":"Change-Id: I6537bb1da5ef0d6899bc71e4e949f2c760c103c2"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":9,"id":"fa98f980_961957d9","line":25,"updated":"2014-09-04 08:33:35.000000000","message":"the convention is:\n\nCloses-Bug: #1357379\nRelated-Bug: #1338880","commit_id":"ebff0efe0c2e05969c3bb0f8ef77585762ff2840"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"222a676767381fba0338fdbf1990505808a7702b","unresolved":false,"context_lines":[{"line_number":22,"context_line":""},{"line_number":23,"context_line":"Added unit-tests."},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"Closes-Bug: 1357379"},{"line_number":26,"context_line":"Related-Bug: 1338880"},{"line_number":27,"context_line":"Change-Id: I6537bb1da5ef0d6899bc71e4e949f2c760c103c2"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":9,"id":"fa98f980_a570bf08","line":25,"in_reply_to":"fa98f980_961957d9","updated":"2014-09-15 17:34:47.000000000","message":"Done","commit_id":"ebff0efe0c2e05969c3bb0f8ef77585762ff2840"}],"neutron/api/v2/base.py":[{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"31971c7be5c14d0c5b2189ed22fb6f98d085daab","unresolved":false,"context_lines":[{"line_number":516,"context_line":"        # Add a list of attributes to be updated to help"},{"line_number":517,"context_line":"        # policy enforcer to distinguish which attributes"},{"line_number":518,"context_line":"        # are set explicitly to correctly create rules to match"},{"line_number":519,"context_line":"        orig_obj[\u0027updated\u0027] \u003d body[self._resource].keys()"},{"line_number":520,"context_line":"        try:"},{"line_number":521,"context_line":"            policy.enforce(request.context,"},{"line_number":522,"context_line":"                           action,"}],"source_content_type":"text/x-python","patch_set":7,"id":"1abeadc6_e03a3933","line":519,"updated":"2014-08-19 17:52:40.000000000","message":"\u0027updated\u0027 seems too simple name for such attribute and can potentially overlap with API attribute, so I suggest changing this key to something more tricky, and also - make it a string constant","commit_id":"09f6112c273ccebf336652e805b4301946921997"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"43698a9c3a5103bdce368975cde4a3ed6aff0c2e","unresolved":false,"context_lines":[{"line_number":516,"context_line":"        # Add a list of attributes to be updated to help"},{"line_number":517,"context_line":"        # policy enforcer to distinguish which attributes"},{"line_number":518,"context_line":"        # are set explicitly to correctly create rules to match"},{"line_number":519,"context_line":"        orig_obj[\u0027updated\u0027] \u003d body[self._resource].keys()"},{"line_number":520,"context_line":"        try:"},{"line_number":521,"context_line":"            policy.enforce(request.context,"},{"line_number":522,"context_line":"                           action,"}],"source_content_type":"text/x-python","patch_set":7,"id":"1abeadc6_7d595459","line":519,"in_reply_to":"1abeadc6_e03a3933","updated":"2014-08-20 09:58:58.000000000","message":"Made it a string constant and moved to neutron/common/constants","commit_id":"09f6112c273ccebf336652e805b4301946921997"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"5efbbd336ccf111bcafae2c74ebc0962b21e0106","unresolved":false,"context_lines":[{"line_number":515,"context_line":"        orig_obj.update(body[self._resource])"},{"line_number":516,"context_line":"        # Add a list of attributes to be updated to help"},{"line_number":517,"context_line":"        # policy enforcer to distinguish which attributes"},{"line_number":518,"context_line":"        # are set explicitly to correctly create rules to match"},{"line_number":519,"context_line":"        orig_obj[const.MARKED_FOR_UPDATE] \u003d body[self._resource].keys()"},{"line_number":520,"context_line":"        try:"},{"line_number":521,"context_line":"            policy.enforce(request.context,"}],"source_content_type":"text/x-python","patch_set":10,"id":"fa98f980_8df0b6ca","line":518,"updated":"2014-09-19 14:00:30.000000000","message":"pedantry: explicitly note the list of attributes to be update to inform the policy engine of which attributes are explicitly sets and which ones set to their default values\n\n(the above is just an optional advice, feel free to improve wording as you prefer)","commit_id":"5e41b227667a3f07e1f5f987d984f56d33f64145"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"bf41a1b1c1d6ee7b5a6c7f53847884aa471f03ed","unresolved":false,"context_lines":[{"line_number":515,"context_line":"        orig_obj.update(body[self._resource])"},{"line_number":516,"context_line":"        # Add a list of attributes to be updated to help"},{"line_number":517,"context_line":"        # policy enforcer to distinguish which attributes"},{"line_number":518,"context_line":"        # are set explicitly to correctly create rules to match"},{"line_number":519,"context_line":"        orig_obj[const.MARKED_FOR_UPDATE] \u003d body[self._resource].keys()"},{"line_number":520,"context_line":"        try:"},{"line_number":521,"context_line":"            policy.enforce(request.context,"}],"source_content_type":"text/x-python","patch_set":10,"id":"da9df570_34b6883e","line":518,"in_reply_to":"fa98f980_8df0b6ca","updated":"2014-09-22 07:58:20.000000000","message":"Done","commit_id":"5e41b227667a3f07e1f5f987d984f56d33f64145"}],"neutron/common/constants.py":[{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"5efbbd336ccf111bcafae2c74ebc0962b21e0106","unresolved":false,"context_lines":[{"line_number":140,"context_line":"# Linux interface max length"},{"line_number":141,"context_line":"DEVICE_NAME_MAX_LEN \u003d 15"},{"line_number":142,"context_line":""},{"line_number":143,"context_line":"MARKED_FOR_UPDATE \u003d \u0027marked_for_update\u0027"}],"source_content_type":"text/x-python","patch_set":10,"id":"fa98f980_6dc8f275","line":143,"updated":"2014-09-19 14:00:30.000000000","message":"More pedantry about naming. Consider ATTRIBUTES_TO_UPDATE or something like that.\n\nThe semantics of this attribute on a target for the policy engine is that it contains a list of attributes which the user explicitly wishes to update as they were passed in the request body.","commit_id":"5e41b227667a3f07e1f5f987d984f56d33f64145"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"bf41a1b1c1d6ee7b5a6c7f53847884aa471f03ed","unresolved":false,"context_lines":[{"line_number":140,"context_line":"# Linux interface max length"},{"line_number":141,"context_line":"DEVICE_NAME_MAX_LEN \u003d 15"},{"line_number":142,"context_line":""},{"line_number":143,"context_line":"MARKED_FOR_UPDATE \u003d \u0027marked_for_update\u0027"}],"source_content_type":"text/x-python","patch_set":10,"id":"da9df570_54822c53","line":143,"in_reply_to":"fa98f980_6dc8f275","updated":"2014-09-22 07:58:20.000000000","message":"Done","commit_id":"5e41b227667a3f07e1f5f987d984f56d33f64145"}],"neutron/db/db_base_plugin_v2.py":[{"author":{"_account_id":8767,"name":"Nikolay Fedotov","email":"nfedotov@cisco.com","username":"nfedotov"},"change_message_id":"8a9f2987b4d4be71d93dc5b51429f4178635e3dc","unresolved":false,"context_lines":[{"line_number":763,"context_line":"            return [aa for aa in a if aa not in b]"},{"line_number":764,"context_line":""},{"line_number":765,"context_line":"        if mark_autofilled:"},{"line_number":766,"context_line":"            autofilled \u003d diff(fields, res.keys())"},{"line_number":767,"context_line":"            res[\u0027autofilled\u0027] \u003d autofilled"},{"line_number":768,"context_line":"        # Call auxiliary extend functions, if any"},{"line_number":769,"context_line":"        if process_extensions:"}],"source_content_type":"text/x-python","patch_set":4,"id":"1abeadc6_80aaa017","line":766,"updated":"2014-08-18 15:18:22.000000000","message":"\u0027set\u0027 data type has s.difference(t) method (or s - t)","commit_id":"e0fd411642e40e0a4a7864ed564532e9f89fe37c"}],"neutron/policy.py":[{"author":{"_account_id":6659,"name":"Paul Michali","email":"pc@michali.net","username":"pcm"},"change_message_id":"798b53d4b17f6d34139037d28fbc369e6ebd59f1","unresolved":false,"context_lines":[{"line_number":124,"context_line":"def _is_attribute_explicitly_set(attribute_name, resource, target, action):"},{"line_number":125,"context_line":"    \"\"\"Verify that an attribute is present and is explicitly set.\"\"\""},{"line_number":126,"context_line":"    if \u0027update\u0027 in action:"},{"line_number":127,"context_line":"        # In case of update the function should not pay attention to a default"},{"line_number":128,"context_line":"        # value of an attribute, but check whether it was explicitly marked"},{"line_number":129,"context_line":"        # as being updated instead."},{"line_number":130,"context_line":"        return (attribute_name in target and"}],"source_content_type":"text/x-python","patch_set":8,"id":"1abeadc6_57e54c36","line":127,"updated":"2014-08-20 14:47:41.000000000","message":"nit: update -\u003e update,","commit_id":"f1a1047756e5db2646eee4ca16c9e2092cba091d"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"4c15121913c2ca170804079a582b0ec26b3ef644","unresolved":false,"context_lines":[{"line_number":124,"context_line":"def _is_attribute_explicitly_set(attribute_name, resource, target, action):"},{"line_number":125,"context_line":"    \"\"\"Verify that an attribute is present and is explicitly set.\"\"\""},{"line_number":126,"context_line":"    if \u0027update\u0027 in action:"},{"line_number":127,"context_line":"        # In case of update the function should not pay attention to a default"},{"line_number":128,"context_line":"        # value of an attribute, but check whether it was explicitly marked"},{"line_number":129,"context_line":"        # as being updated instead."},{"line_number":130,"context_line":"        return (attribute_name in target and"}],"source_content_type":"text/x-python","patch_set":8,"id":"1abeadc6_300b558f","line":127,"in_reply_to":"1abeadc6_57e54c36","updated":"2014-08-21 11:10:08.000000000","message":"Done","commit_id":"f1a1047756e5db2646eee4ca16c9e2092cba091d"},{"author":{"_account_id":6659,"name":"Paul Michali","email":"pc@michali.net","username":"pcm"},"change_message_id":"798b53d4b17f6d34139037d28fbc369e6ebd59f1","unresolved":false,"context_lines":[{"line_number":194,"context_line":"                        if (validate and any([k.startswith(\u0027type:dict\u0027) and v"},{"line_number":195,"context_line":"                                              for (k, v) in"},{"line_number":196,"context_line":"                                              validate.iteritems()]) and"},{"line_number":197,"context_line":"                                isinstance(target[attribute_name],"},{"line_number":198,"context_line":"                                           collections.Iterable)):"},{"line_number":199,"context_line":"                            attr_rule \u003d policy.AndCheck("},{"line_number":200,"context_line":"                                [attr_rule, _build_subattr_match_rule("}],"source_content_type":"text/x-python","patch_set":8,"id":"1abeadc6_774408b7","line":197,"updated":"2014-08-20 14:47:41.000000000","message":"For readability, consider creating a helper method (with a great name) for this complex expression to use in the if-clause. For example (only using a better name)\n\n    if _sub_attribute_valid(target[attribute_name], attribute):\n        ...\n\nwhere the method can check if have validate attribute with type:dict key, and iterable.","commit_id":"f1a1047756e5db2646eee4ca16c9e2092cba091d"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"4c15121913c2ca170804079a582b0ec26b3ef644","unresolved":false,"context_lines":[{"line_number":194,"context_line":"                        if (validate and any([k.startswith(\u0027type:dict\u0027) and v"},{"line_number":195,"context_line":"                                              for (k, v) in"},{"line_number":196,"context_line":"                                              validate.iteritems()]) and"},{"line_number":197,"context_line":"                                isinstance(target[attribute_name],"},{"line_number":198,"context_line":"                                           collections.Iterable)):"},{"line_number":199,"context_line":"                            attr_rule \u003d policy.AndCheck("},{"line_number":200,"context_line":"                                [attr_rule, _build_subattr_match_rule("}],"source_content_type":"text/x-python","patch_set":8,"id":"1abeadc6_50fc5172","line":197,"in_reply_to":"1abeadc6_774408b7","updated":"2014-08-21 11:10:08.000000000","message":"Done","commit_id":"f1a1047756e5db2646eee4ca16c9e2092cba091d"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"276b12c87ebac450bce93b11fa9fc63e18d6b6a0","unresolved":false,"context_lines":[{"line_number":141,"context_line":"    validate \u003d attribute.get(\u0027validate\u0027)"},{"line_number":142,"context_line":"    return (validate and any([k.startswith(\u0027type:dict\u0027) and v"},{"line_number":143,"context_line":"                              for (k, v) in validate.iteritems()]) and"},{"line_number":144,"context_line":"            isinstance(sub_attr, collections.Iterable))"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":""},{"line_number":147,"context_line":"def _build_subattr_match_rule(attr_name, attr, action, target):"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa98f980_911c9d79","line":144,"updated":"2014-09-08 12:51:11.000000000","message":"isinstance seems cheaper than the other side of and.  it\u0027s better to test cheaper one first.","commit_id":"ebff0efe0c2e05969c3bb0f8ef77585762ff2840"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"222a676767381fba0338fdbf1990505808a7702b","unresolved":false,"context_lines":[{"line_number":141,"context_line":"    validate \u003d attribute.get(\u0027validate\u0027)"},{"line_number":142,"context_line":"    return (validate and any([k.startswith(\u0027type:dict\u0027) and v"},{"line_number":143,"context_line":"                              for (k, v) in validate.iteritems()]) and"},{"line_number":144,"context_line":"            isinstance(sub_attr, collections.Iterable))"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":""},{"line_number":147,"context_line":"def _build_subattr_match_rule(attr_name, attr, action, target):"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa98f980_05598b8d","line":144,"in_reply_to":"fa98f980_0540ab05","updated":"2014-09-15 17:34:47.000000000","message":"Done","commit_id":"ebff0efe0c2e05969c3bb0f8ef77585762ff2840"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"53b8cb14937da103df856de41d0f42da224f444c","unresolved":false,"context_lines":[{"line_number":141,"context_line":"    validate \u003d attribute.get(\u0027validate\u0027)"},{"line_number":142,"context_line":"    return (validate and any([k.startswith(\u0027type:dict\u0027) and v"},{"line_number":143,"context_line":"                              for (k, v) in validate.iteritems()]) and"},{"line_number":144,"context_line":"            isinstance(sub_attr, collections.Iterable))"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":""},{"line_number":147,"context_line":"def _build_subattr_match_rule(attr_name, attr, action, target):"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa98f980_0540ab05","line":144,"in_reply_to":"fa98f980_911c9d79","updated":"2014-09-15 05:35:59.000000000","message":"Okay, I\u0027ll move it","commit_id":"ebff0efe0c2e05969c3bb0f8ef77585762ff2840"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"276b12c87ebac450bce93b11fa9fc63e18d6b6a0","unresolved":false,"context_lines":[{"line_number":198,"context_line":"                                                     (action, attribute_name))"},{"line_number":199,"context_line":"                        # Build match entries for sub-attributes"},{"line_number":200,"context_line":"                        if _should_validate_sub_attributes("},{"line_number":201,"context_line":"                                attribute, target[attribute_name]):"},{"line_number":202,"context_line":"                            attr_rule \u003d policy.AndCheck("},{"line_number":203,"context_line":"                                [attr_rule, _build_subattr_match_rule("},{"line_number":204,"context_line":"                                    attribute_name, attribute,"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa98f980_b16c410a","line":201,"updated":"2014-09-08 12:51:11.000000000","message":"how is this part of change related to the rest?","commit_id":"ebff0efe0c2e05969c3bb0f8ef77585762ff2840"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"53b8cb14937da103df856de41d0f42da224f444c","unresolved":false,"context_lines":[{"line_number":198,"context_line":"                                                     (action, attribute_name))"},{"line_number":199,"context_line":"                        # Build match entries for sub-attributes"},{"line_number":200,"context_line":"                        if _should_validate_sub_attributes("},{"line_number":201,"context_line":"                                attribute, target[attribute_name]):"},{"line_number":202,"context_line":"                            attr_rule \u003d policy.AndCheck("},{"line_number":203,"context_line":"                                [attr_rule, _build_subattr_match_rule("},{"line_number":204,"context_line":"                                    attribute_name, attribute,"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa98f980_a5fc3fb6","line":201,"in_reply_to":"fa98f980_b16c410a","updated":"2014-09-15 05:35:59.000000000","message":"Changing the behavior of _is_attribute_explicitly_set revealed a problem that trying to build a subattr_match_rule results with an Exception if it has None value and thus is not iterable.\n\nThat\u0027s why I added this isinstance(sub_attr, collections.Iterable check and updated some tests accordingly.","commit_id":"ebff0efe0c2e05969c3bb0f8ef77585762ff2840"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"5efbbd336ccf111bcafae2c74ebc0962b21e0106","unresolved":false,"context_lines":[{"line_number":129,"context_line":"        # marked as being updated instead."},{"line_number":130,"context_line":"        return (attribute_name in target and"},{"line_number":131,"context_line":"                target[attribute_name] is not attributes.ATTR_NOT_SPECIFIED"},{"line_number":132,"context_line":"                and attribute_name in target[const.MARKED_FOR_UPDATE])"},{"line_number":133,"context_line":"    return (\u0027default\u0027 in resource[attribute_name] and"},{"line_number":134,"context_line":"            attribute_name in target and"},{"line_number":135,"context_line":"            target[attribute_name] is not attributes.ATTR_NOT_SPECIFIED and"}],"source_content_type":"text/x-python","patch_set":10,"id":"fa98f980_8d8fd674","line":132,"updated":"2014-09-19 14:00:30.000000000","message":"if attribute_name is in target[const.MARKED_FOR_UPDATE] it will likely be also in target... therefore the first clause of this statement might be redundant","commit_id":"5e41b227667a3f07e1f5f987d984f56d33f64145"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"05e24e365009e5bdcf93ef940dda351df8186f15","unresolved":false,"context_lines":[{"line_number":129,"context_line":"        # marked as being updated instead."},{"line_number":130,"context_line":"        return (attribute_name in target and"},{"line_number":131,"context_line":"                target[attribute_name] is not attributes.ATTR_NOT_SPECIFIED"},{"line_number":132,"context_line":"                and attribute_name in target[const.MARKED_FOR_UPDATE])"},{"line_number":133,"context_line":"    return (\u0027default\u0027 in resource[attribute_name] and"},{"line_number":134,"context_line":"            attribute_name in target and"},{"line_number":135,"context_line":"            target[attribute_name] is not attributes.ATTR_NOT_SPECIFIED and"}],"source_content_type":"text/x-python","patch_set":10,"id":"fa98f980_a6c2f750","line":132,"in_reply_to":"fa98f980_8d8fd674","updated":"2014-09-19 15:37:01.000000000","message":"Agreed","commit_id":"5e41b227667a3f07e1f5f987d984f56d33f64145"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"bf41a1b1c1d6ee7b5a6c7f53847884aa471f03ed","unresolved":false,"context_lines":[{"line_number":129,"context_line":"        # marked as being updated instead."},{"line_number":130,"context_line":"        return (attribute_name in target and"},{"line_number":131,"context_line":"                target[attribute_name] is not attributes.ATTR_NOT_SPECIFIED"},{"line_number":132,"context_line":"                and attribute_name in target[const.MARKED_FOR_UPDATE])"},{"line_number":133,"context_line":"    return (\u0027default\u0027 in resource[attribute_name] and"},{"line_number":134,"context_line":"            attribute_name in target and"},{"line_number":135,"context_line":"            target[attribute_name] is not attributes.ATTR_NOT_SPECIFIED and"}],"source_content_type":"text/x-python","patch_set":10,"id":"da9df570_947c9474","line":132,"in_reply_to":"fa98f980_a6c2f750","updated":"2014-09-22 07:58:20.000000000","message":"Done","commit_id":"5e41b227667a3f07e1f5f987d984f56d33f64145"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"5efbbd336ccf111bcafae2c74ebc0962b21e0106","unresolved":false,"context_lines":[{"line_number":133,"context_line":"    return (\u0027default\u0027 in resource[attribute_name] and"},{"line_number":134,"context_line":"            attribute_name in target and"},{"line_number":135,"context_line":"            target[attribute_name] is not attributes.ATTR_NOT_SPECIFIED and"},{"line_number":136,"context_line":"            target[attribute_name] !\u003d resource[attribute_name][\u0027default\u0027])"},{"line_number":137,"context_line":""},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"def _should_validate_sub_attributes(attribute, sub_attr):"}],"source_content_type":"text/x-python","patch_set":10,"id":"fa98f980_cdcf1eb2","line":136,"updated":"2014-09-19 14:00:30.000000000","message":"these statements at line 130 and 133 are so similar that maybe the common bits can be factored out thus making the code a bit more readable.","commit_id":"5e41b227667a3f07e1f5f987d984f56d33f64145"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"05e24e365009e5bdcf93ef940dda351df8186f15","unresolved":false,"context_lines":[{"line_number":133,"context_line":"    return (\u0027default\u0027 in resource[attribute_name] and"},{"line_number":134,"context_line":"            attribute_name in target and"},{"line_number":135,"context_line":"            target[attribute_name] is not attributes.ATTR_NOT_SPECIFIED and"},{"line_number":136,"context_line":"            target[attribute_name] !\u003d resource[attribute_name][\u0027default\u0027])"},{"line_number":137,"context_line":""},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"def _should_validate_sub_attributes(attribute, sub_attr):"}],"source_content_type":"text/x-python","patch_set":10,"id":"fa98f980_e665df1d","line":136,"in_reply_to":"fa98f980_cdcf1eb2","updated":"2014-09-19 15:37:01.000000000","message":"These two comments contradict each other. If we remove if attribute_name in target (L 130), then moving the common statement target[attribute_name] is not attributes.ATTR_NOT_SPECIFIED will still lead to to if attribute_name in target being checked and this would decrease readability.\n\nExample:\n\ndef _is_attribute_explicitly_set(attribute_name, resource, target, action):\n    \"\"\"Verify that an attribute is present and is explicitly set.\"\"\"\n    attr_specified \u003d (attribute_name in target and target[attribute_name] is\n                      not attributes.ATTR_NOT_SPECIFIED)\n    if \u0027update\u0027 in action:\n        # In the case of update, the function should not pay attention to a\n        # default value of an attribute, but check whether it was explicitly\n        # marked as being updated instead.\n        return (attr_specified and\n                attribute_name in target[const.ATTRIBUTES_TO_UPDATE])\n    return (attr_specified and \u0027default\u0027 in resource[attribute_name] and\n            target[attribute_name] !\u003d resource[attribute_name][\u0027default\u0027])","commit_id":"5e41b227667a3f07e1f5f987d984f56d33f64145"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"5efbbd336ccf111bcafae2c74ebc0962b21e0106","unresolved":false,"context_lines":[{"line_number":139,"context_line":"def _should_validate_sub_attributes(attribute, sub_attr):"},{"line_number":140,"context_line":"    \"\"\"Verify that sub-attributes are iterable and should be validated.\"\"\""},{"line_number":141,"context_line":"    validate \u003d attribute.get(\u0027validate\u0027)"},{"line_number":142,"context_line":"    return (validate and isinstance(sub_attr, collections.Iterable) and"},{"line_number":143,"context_line":"            any([k.startswith(\u0027type:dict\u0027) and"},{"line_number":144,"context_line":"                 v for (k, v) in validate.iteritems()]))"},{"line_number":145,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"fa98f980_cd2b9e31","line":142,"updated":"2014-09-19 14:00:30.000000000","message":"why the need for checking is subattr is iterable?","commit_id":"5e41b227667a3f07e1f5f987d984f56d33f64145"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"b64c84d7c91f5a15c5dd63b86cfc05fde6782aca","unresolved":false,"context_lines":[{"line_number":139,"context_line":"def _should_validate_sub_attributes(attribute, sub_attr):"},{"line_number":140,"context_line":"    \"\"\"Verify that sub-attributes are iterable and should be validated.\"\"\""},{"line_number":141,"context_line":"    validate \u003d attribute.get(\u0027validate\u0027)"},{"line_number":142,"context_line":"    return (validate and isinstance(sub_attr, collections.Iterable) and"},{"line_number":143,"context_line":"            any([k.startswith(\u0027type:dict\u0027) and"},{"line_number":144,"context_line":"                 v for (k, v) in validate.iteritems()]))"},{"line_number":145,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"da9df570_bf63e3da","line":142,"in_reply_to":"fa98f980_2d3eeada","updated":"2014-09-24 13:30:39.000000000","message":"make sense. Policy on subattributes are evil and should be removed... well actually subattributes are not great either ;)","commit_id":"5e41b227667a3f07e1f5f987d984f56d33f64145"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"b2cfb19d67868cf1d918f85eff8f0a797283d196","unresolved":false,"context_lines":[{"line_number":139,"context_line":"def _should_validate_sub_attributes(attribute, sub_attr):"},{"line_number":140,"context_line":"    \"\"\"Verify that sub-attributes are iterable and should be validated.\"\"\""},{"line_number":141,"context_line":"    validate \u003d attribute.get(\u0027validate\u0027)"},{"line_number":142,"context_line":"    return (validate and isinstance(sub_attr, collections.Iterable) and"},{"line_number":143,"context_line":"            any([k.startswith(\u0027type:dict\u0027) and"},{"line_number":144,"context_line":"                 v for (k, v) in validate.iteritems()]))"},{"line_number":145,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"fa98f980_2d3eeada","line":142,"in_reply_to":"fa98f980_cd2b9e31","updated":"2014-09-19 14:21:47.000000000","message":"Changing the behavior of _is_attribute_explicitly_set revealed a problem that trying to build a subattr_match_rule results with an Exception if the subattribute has a None value and thus is not iterable.\n\nThat\u0027s why I added this isinstance(sub_attr, collections.Iterable check and updated some tests accordingly.","commit_id":"5e41b227667a3f07e1f5f987d984f56d33f64145"}]}
