)]}'
{"neutron/objects/base.py":[{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"74258daaf7d79c181dedd43ca870a207e19577ee","unresolved":false,"context_lines":[{"line_number":135,"context_line":"                invalid_fields.append(syn_field)"},{"line_number":136,"context_line":"        if invalid_fields:"},{"line_number":137,"context_line":"            raise NeutronSyntheticFieldInvalid(field\u003dinvalid_fields)"},{"line_number":138,"context_line":"        return type(name, (SyntheticFieldValidator,) + bases, dct)"},{"line_number":139,"context_line":""},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"@six.add_metaclass(abc.ABCMeta)"}],"source_content_type":"text/x-python","patch_set":4,"id":"1ac06dbe_b230ec08","line":138,"updated":"2016-08-25 13:24:13.000000000","message":"I don\u0027t think there is big reason to do validation prior to class creation.\n\nInstead, you could\n\n    cls \u003d type(...)\n    for field in cls.synthetic_fields:\n        if field not in cls.fields:\n             raise ...","commit_id":"acdb3be16403b5240d528c6a24b2bcf533f91f3e"},{"author":{"_account_id":7037,"name":"John Perkins","email":"john.perkins@rackspace.com","username":"JPerkins"},"change_message_id":"23e098dc3ccdf7880dd0ce023e269835c5352cc8","unresolved":false,"context_lines":[{"line_number":135,"context_line":"                invalid_fields.append(syn_field)"},{"line_number":136,"context_line":"        if invalid_fields:"},{"line_number":137,"context_line":"            raise NeutronSyntheticFieldInvalid(field\u003dinvalid_fields)"},{"line_number":138,"context_line":"        return type(name, (SyntheticFieldValidator,) + bases, dct)"},{"line_number":139,"context_line":""},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"@six.add_metaclass(abc.ABCMeta)"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a89bdaa_75ead0ad","line":138,"in_reply_to":"1ac06dbe_b230ec08","updated":"2016-09-06 22:39:04.000000000","message":"Done","commit_id":"acdb3be16403b5240d528c6a24b2bcf533f91f3e"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"74258daaf7d79c181dedd43ca870a207e19577ee","unresolved":false,"context_lines":[{"line_number":139,"context_line":""},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"@six.add_metaclass(abc.ABCMeta)"},{"line_number":142,"context_line":"@six.add_metaclass(SyntheticFieldValidator)"},{"line_number":143,"context_line":"class NeutronObject(obj_base.VersionedObject,"},{"line_number":144,"context_line":"                    obj_base.VersionedObjectDictCompat,"},{"line_number":145,"context_line":"                    obj_base.ComparableVersionedObject):"}],"source_content_type":"text/x-python","patch_set":4,"id":"1ac06dbe_26a5e103","line":142,"updated":"2016-08-25 13:24:13.000000000","message":"Since we probably can reuse the same metaclass for other declarative attributes cross validation, it would be better to have a more generic name for the metaclass. Like NeutronObjectValidator.\n\nbtw I was wondering, would it make more sense to move DeclarativeObject application from NeutronDbObject to NeutronObject? Then we could reuse the existing metaclass to enforce the validation you look into. What d\u0027you think?","commit_id":"acdb3be16403b5240d528c6a24b2bcf533f91f3e"},{"author":{"_account_id":7037,"name":"John Perkins","email":"john.perkins@rackspace.com","username":"JPerkins"},"change_message_id":"23e098dc3ccdf7880dd0ce023e269835c5352cc8","unresolved":false,"context_lines":[{"line_number":139,"context_line":""},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"@six.add_metaclass(abc.ABCMeta)"},{"line_number":142,"context_line":"@six.add_metaclass(SyntheticFieldValidator)"},{"line_number":143,"context_line":"class NeutronObject(obj_base.VersionedObject,"},{"line_number":144,"context_line":"                    obj_base.VersionedObjectDictCompat,"},{"line_number":145,"context_line":"                    obj_base.ComparableVersionedObject):"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a89bdaa_15bee464","line":142,"in_reply_to":"1ac06dbe_26a5e103","updated":"2016-09-06 22:39:04.000000000","message":"done.\n\nMoving DeclarativeObject logic into NeutronObject makes a lot of sense: we\u0027d have fewer classes to manage in the long run, what\u0027s happening would be more explicit, and I can\u0027t see where else a DeclarativeObject would be needed (are we ever going to need a NeutronQueueObject?)","commit_id":"acdb3be16403b5240d528c6a24b2bcf533f91f3e"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"21d12eb57c6226bc395b5e5d0b9965cd0c25f25c","unresolved":false,"context_lines":[{"line_number":128,"context_line":"        return self.__dict__ \u003d\u003d other.__dict__"},{"line_number":129,"context_line":""},{"line_number":130,"context_line":""},{"line_number":131,"context_line":"class NeutronObjectValidator(type):"},{"line_number":132,"context_line":"    def __new__(mcs, name, bases, dct):"},{"line_number":133,"context_line":"        invalid_fields \u003d []"},{"line_number":134,"context_line":"        for field in dct[\u0027synthetic_fields\u0027]:"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a89bdaa_f9a5e0a1","line":131,"updated":"2016-09-07 10:33:39.000000000","message":"I don\u0027t see where you hook the metaclass to neutron objects though.","commit_id":"bf5a50ffbfc755253db4cf0b682b3d685b735884"}],"neutron/tests/unit/objects/test_base.py":[{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"74258daaf7d79c181dedd43ca870a207e19577ee","unresolved":false,"context_lines":[{"line_number":908,"context_line":"                                                test_base.BaseTestCase):"},{"line_number":909,"context_line":""},{"line_number":910,"context_line":"    def test_load_invalid_synthetic_fields_fails(self):"},{"line_number":911,"context_line":"        try:"},{"line_number":912,"context_line":"            @obj_base.VersionedObjectRegistry.register_if(False)"},{"line_number":913,"context_line":"            class FakeNeutronObjectInvalidSyntheticField(base.NeutronDbObject):"},{"line_number":914,"context_line":"                # Version 1.0: Initial version"}],"source_content_type":"text/x-python","patch_set":4,"id":"1ac06dbe_a6bef1fc","line":911,"updated":"2016-08-25 13:24:13.000000000","message":"cool","commit_id":"acdb3be16403b5240d528c6a24b2bcf533f91f3e"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"74258daaf7d79c181dedd43ca870a207e19577ee","unresolved":false,"context_lines":[{"line_number":930,"context_line":"            b \u003d FakeNeutronObjectInvalidSyntheticField()"},{"line_number":931,"context_line":"        except base.NeutronSyntheticFieldInvalid:"},{"line_number":932,"context_line":"            return"},{"line_number":933,"context_line":"        raise Exception(\"An invalid synthetic field should raise \""},{"line_number":934,"context_line":"                        \"NeutronSyntheticFieldInvalid\")"},{"line_number":935,"context_line":""},{"line_number":936,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1ac06dbe_e6cf49b1","line":933,"updated":"2016-08-25 13:24:13.000000000","message":"probably a bit more explicit is calling to self.fail() instead of raising a random exception.","commit_id":"acdb3be16403b5240d528c6a24b2bcf533f91f3e"},{"author":{"_account_id":7037,"name":"John Perkins","email":"john.perkins@rackspace.com","username":"JPerkins"},"change_message_id":"23e098dc3ccdf7880dd0ce023e269835c5352cc8","unresolved":false,"context_lines":[{"line_number":930,"context_line":"            b \u003d FakeNeutronObjectInvalidSyntheticField()"},{"line_number":931,"context_line":"        except base.NeutronSyntheticFieldInvalid:"},{"line_number":932,"context_line":"            return"},{"line_number":933,"context_line":"        raise Exception(\"An invalid synthetic field should raise \""},{"line_number":934,"context_line":"                        \"NeutronSyntheticFieldInvalid\")"},{"line_number":935,"context_line":""},{"line_number":936,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"9a89bdaa_b5aff828","line":933,"in_reply_to":"1ac06dbe_e6cf49b1","updated":"2016-09-06 22:39:04.000000000","message":"Done","commit_id":"acdb3be16403b5240d528c6a24b2bcf533f91f3e"}]}
