)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":1779,"name":"Daniel Berrange","email":"berrange@redhat.com","username":"berrange"},"change_message_id":"c31752b7bbaf5e753f0894a2aca54d4f64d857e2","unresolved":false,"context_lines":[{"line_number":9,"context_line":"The need to redefine the typenames of versioned object is a common"},{"line_number":10,"context_line":"usecase, which may be required either to make object name differ from"},{"line_number":11,"context_line":"the python\u0027s classname or to give a same name to two different types to"},{"line_number":12,"context_line":"indicates their duck-type compatibility."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"The existing way of doing this is to override obj_name() classmethod of"},{"line_number":15,"context_line":"VersionedObject class to return a needed string constant instead of"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"fa32b979_178663db","line":12,"updated":"2015-06-22 13:35:00.000000000","message":"What is the use case for wanting to change names like this ?\n\nI\u0027m inclined to say that we should strongly discourage people from ever overriding the \u0027obj_name\u0027 method at all, as I think it\u0027ll make life more confusing for developers in general if the versioned object name is different from the python class name.","commit_id":"427cb515b1a31edca047d324536f101007176ad6"},{"author":{"_account_id":8127,"name":"Alexander Tivelkov","email":"locher@yandex.ru","username":"ativelkov"},"change_message_id":"5be62efed5ff60ada4d070aac220d36f52cf0a6e","unresolved":false,"context_lines":[{"line_number":9,"context_line":"The need to redefine the typenames of versioned object is a common"},{"line_number":10,"context_line":"usecase, which may be required either to make object name differ from"},{"line_number":11,"context_line":"the python\u0027s classname or to give a same name to two different types to"},{"line_number":12,"context_line":"indicates their duck-type compatibility."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"The existing way of doing this is to override obj_name() classmethod of"},{"line_number":15,"context_line":"VersionedObject class to return a needed string constant instead of"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"fa32b979_2b769b3e","line":12,"in_reply_to":"fa32b979_178663db","updated":"2015-06-22 15:24:11.000000000","message":"Well, there may be several reasons.\n\nFirst of all, there may be several python classes having the same name but defined in different packages: they will have identical cls.__name__ and so will collide. If you are doing some plugin-based solution such collisions are quite likely and hard to control. \n\nAnother approach: one may define a next version of some type by subclassing from the previous version (a bad, but quite a usual practice if the change requires just a small change in a single field), and then override the name of the subclass, i.e. something like this: http://paste.openstack.org/show/313689/\n\nIn general, I\u0027d prefer to have a clean separation of schema (defined by type name, version, and combination of fields and method declarations) from its implementation as a python class.","commit_id":"427cb515b1a31edca047d324536f101007176ad6"},{"author":{"_account_id":1779,"name":"Daniel Berrange","email":"berrange@redhat.com","username":"berrange"},"change_message_id":"c31752b7bbaf5e753f0894a2aca54d4f64d857e2","unresolved":false,"context_lines":[{"line_number":26,"context_line":"The old way of overriding the obj_name() is still available for"},{"line_number":27,"context_line":"backwards compatibility purposes but is not recommended for usage unless"},{"line_number":28,"context_line":"it is required to have all the descendants to have the same obj_name"},{"line_number":29,"context_line":"with their parent."},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"Change-Id: I4973aec459cdd49972b062132d0367e853b33caa"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"fa32b979_b7dbf7ec","line":29,"updated":"2015-06-22 13:35:00.000000000","message":"I\u0027d actually just suggest we do nothing except discourage obj_name overriding entirely. If people want to override it, then they are responsible for making sure the semantics of their new impl do the right thing wrt to further subclasses. I don\u0027t see a compelling need to introduce a NAME attribute in the base class.","commit_id":"427cb515b1a31edca047d324536f101007176ad6"}]}
