)]}'
{"neutron/tests/unit/notifiers/test_nova.py":[{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"138d2734c07471d6291fa738f7bca0ff589a6bae","unresolved":false,"context_lines":[{"line_number":105,"context_line":"    def _record_port_status_changed_helper(self, current_port_status,"},{"line_number":106,"context_line":"                                           previous_port_status, port):"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"        if not (port.device_id and port.id and port.device_owner and"},{"line_number":109,"context_line":"                port.device_owner.startswith("},{"line_number":110,"context_line":"                    n_const.DEVICE_OWNER_COMPUTE_PREFIX) and"},{"line_number":111,"context_line":"                uuidutils.is_uuid_like(port.device_id)):"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a6eadb0_710de136","side":"PARENT","line":108,"range":{"start_line":108,"start_character":16,"end_line":108,"end_character":64},"updated":"2016-12-19 08:49:45.000000000","message":"I believe the intent here is to validate attribute values, not whether the model/object has such an attribute. So you should actually extract values and use them. But you just check then with hasattr, which is not the same.","commit_id":"4238c20f2a7bbafbd44f84f33ab115b5a5ff35ec"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"c9ffcc888890ae8b54227db5a3435e054b7bed52","unresolved":false,"context_lines":[{"line_number":105,"context_line":"    def _record_port_status_changed_helper(self, current_port_status,"},{"line_number":106,"context_line":"                                           previous_port_status, port):"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"        if not (port.device_id and port.id and port.device_owner and"},{"line_number":109,"context_line":"                port.device_owner.startswith("},{"line_number":110,"context_line":"                    n_const.DEVICE_OWNER_COMPUTE_PREFIX) and"},{"line_number":111,"context_line":"                uuidutils.is_uuid_like(port.device_id)):"}],"source_content_type":"text/x-python","patch_set":2,"id":"bff0334d_11b97d77","side":"PARENT","line":108,"updated":"2017-04-12 20:57:01.000000000","message":"Something is wrong if we are getting attribute errors now. It should always be safe to examine the value of device_id and device_owner. Please avoid using hasattr and troubleshoot the issue leading to the attributeerror.","commit_id":"4238c20f2a7bbafbd44f84f33ab115b5a5ff35ec"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"6729e5a5f72bfd7acdf38a5339b5bfb8d8e9d941","unresolved":false,"context_lines":[{"line_number":105,"context_line":"    def _record_port_status_changed_helper(self, current_port_status,"},{"line_number":106,"context_line":"                                           previous_port_status, port):"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"        if not (port.device_id and port.id and port.device_owner and"},{"line_number":109,"context_line":"                port.device_owner.startswith("},{"line_number":110,"context_line":"                    n_const.DEVICE_OWNER_COMPUTE_PREFIX) and"},{"line_number":111,"context_line":"                uuidutils.is_uuid_like(port.device_id)):"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a6eadb0_cfb5177f","side":"PARENT","line":108,"range":{"start_line":108,"start_character":16,"end_line":108,"end_character":64},"in_reply_to":"1a6eadb0_710de136","updated":"2016-12-19 17:30:47.000000000","message":"when testcases without those values set are run, this check it will return an Attribute error saying no atrribute _obj_id, but it worked fine with model object even when values are not set, may be because of different behavior of objects, I believe it is same what we are checking here is if these three values exists and those will exist if object has attribute set right ?","commit_id":"4238c20f2a7bbafbd44f84f33ab115b5a5ff35ec"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"0c84f8fe82a0986da955579b0c04c7b07ea388d1","unresolved":false,"context_lines":[{"line_number":105,"context_line":"    def _record_port_status_changed_helper(self, current_port_status,"},{"line_number":106,"context_line":"                                           previous_port_status, port):"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"        if not (port.device_id and port.id and port.device_owner and"},{"line_number":109,"context_line":"                port.device_owner.startswith("},{"line_number":110,"context_line":"                    n_const.DEVICE_OWNER_COMPUTE_PREFIX) and"},{"line_number":111,"context_line":"                uuidutils.is_uuid_like(port.device_id)):"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a3905b3_fe382dd5","side":"PARENT","line":108,"range":{"start_line":108,"start_character":16,"end_line":108,"end_character":64},"in_reply_to":"1a6eadb0_cfb5177f","updated":"2017-01-23 17:27:01.000000000","message":"for tests without especially tests without values, will end up like this http://paste.openstack.org/show/596100/ and i tested hasattr(port, \u0027id\u0027) will be false when it does not have attribute value.\n http://paste.openstack.org/show/596101/","commit_id":"4238c20f2a7bbafbd44f84f33ab115b5a5ff35ec"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"16f0e43c0ded7726f84cc851eb653e485cf1ca41","unresolved":false,"context_lines":[{"line_number":105,"context_line":"    def _record_port_status_changed_helper(self, current_port_status,"},{"line_number":106,"context_line":"                                           previous_port_status, port):"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"        if not (port.device_id and port.id and port.device_owner and"},{"line_number":109,"context_line":"                port.device_owner.startswith("},{"line_number":110,"context_line":"                    n_const.DEVICE_OWNER_COMPUTE_PREFIX) and"},{"line_number":111,"context_line":"                uuidutils.is_uuid_like(port.device_id)):"}],"source_content_type":"text/x-python","patch_set":2,"id":"da36d5c6_62f32e9f","side":"PARENT","line":108,"range":{"start_line":108,"start_character":16,"end_line":108,"end_character":64},"in_reply_to":"5a3905b3_fe382dd5","updated":"2017-02-21 16:18:28.000000000","message":"IMO, I prefer to have a separate function that validates all that rules isolated, maybe something like:\n\n    def _is_port_valid(self, port):\n        if not (hasattr(port, \u0027device_id\u0027 and port.device_id):\n            return False\n        if not (hasattr(port, \u0027id\u0027 and port.id):\n            return False\n        ...\n        return True\n\n    def _record_port_status_changed_helper(self, current_port_status, previous_port_status, port):\n        if not self._is_port_valid(port):\n            return","commit_id":"4238c20f2a7bbafbd44f84f33ab115b5a5ff35ec"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"8e790efc58f25e8d945f283e9ca8a5a2e816f891","unresolved":false,"context_lines":[{"line_number":105,"context_line":"    def _record_port_status_changed_helper(self, current_port_status,"},{"line_number":106,"context_line":"                                           previous_port_status, port):"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"        if not (port.device_id and port.id and port.device_owner and"},{"line_number":109,"context_line":"                port.device_owner.startswith("},{"line_number":110,"context_line":"                    n_const.DEVICE_OWNER_COMPUTE_PREFIX) and"},{"line_number":111,"context_line":"                uuidutils.is_uuid_like(port.device_id)):"}],"source_content_type":"text/x-python","patch_set":2,"id":"da36d5c6_dc7f31a9","side":"PARENT","line":108,"range":{"start_line":108,"start_character":16,"end_line":108,"end_character":64},"in_reply_to":"da36d5c6_62f32e9f","updated":"2017-02-22 19:21:19.000000000","message":"helpers for just 1 case ??","commit_id":"4238c20f2a7bbafbd44f84f33ab115b5a5ff35ec"},{"author":{"_account_id":20378,"name":"Trevor McCasland","email":"TM2086@att.com","username":"twm2016"},"change_message_id":"81a3c3de66308933371bb2caf263a31fa880ec6f","unresolved":false,"context_lines":[{"line_number":105,"context_line":"    def _record_port_status_changed_helper(self, current_port_status,"},{"line_number":106,"context_line":"                                           previous_port_status, port):"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"        if not (port.device_id and port.id and port.device_owner and"},{"line_number":109,"context_line":"                port.device_owner.startswith("},{"line_number":110,"context_line":"                    n_const.DEVICE_OWNER_COMPUTE_PREFIX) and"},{"line_number":111,"context_line":"                uuidutils.is_uuid_like(port.device_id)):"}],"source_content_type":"text/x-python","patch_set":2,"id":"da36d5c6_840eea89","side":"PARENT","line":108,"range":{"start_line":108,"start_character":16,"end_line":108,"end_character":64},"in_reply_to":"da36d5c6_69346f49","updated":"2017-02-24 19:56:09.000000000","message":"sorry last sentence should say ...difference between hasattr and accessing the properties...","commit_id":"4238c20f2a7bbafbd44f84f33ab115b5a5ff35ec"},{"author":{"_account_id":20378,"name":"Trevor McCasland","email":"TM2086@att.com","username":"twm2016"},"change_message_id":"e4f8862e5c1b44022884295b8c1412a17d3f1e71","unresolved":false,"context_lines":[{"line_number":105,"context_line":"    def _record_port_status_changed_helper(self, current_port_status,"},{"line_number":106,"context_line":"                                           previous_port_status, port):"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"        if not (port.device_id and port.id and port.device_owner and"},{"line_number":109,"context_line":"                port.device_owner.startswith("},{"line_number":110,"context_line":"                    n_const.DEVICE_OWNER_COMPUTE_PREFIX) and"},{"line_number":111,"context_line":"                uuidutils.is_uuid_like(port.device_id)):"}],"source_content_type":"text/x-python","patch_set":2,"id":"da36d5c6_69346f49","side":"PARENT","line":108,"range":{"start_line":108,"start_character":16,"end_line":108,"end_character":64},"in_reply_to":"da36d5c6_dc7f31a9","updated":"2017-02-24 19:53:40.000000000","message":"I thought these values are validated when they are instantiated. id attribute is validated with UUIDField(), the two other fields, device_id and device_owner, are StringField() where nullable is not set to True.  This calls for further validation which happens on lines 116-118. The difference between ``hasattr`` and ``not`` in this case is not clear to me.","commit_id":"4238c20f2a7bbafbd44f84f33ab115b5a5ff35ec"}]}
