)]}'
{"nova/objects/base.py":[{"author":{"_account_id":1030,"name":"Chris Behrens","email":"cbehrens@codestud.com","username":"cbehrens"},"change_message_id":"5d72d3c75981c366bfeb7df52da8b7077fd3cfea","unresolved":false,"context_lines":[{"line_number":379,"context_line":"        return [x.obj_to_primitive() for x in self.objects]"},{"line_number":380,"context_line":""},{"line_number":381,"context_line":"    def _attr_objects_from_primitive(self, value):"},{"line_number":382,"context_line":"        return [NovaObject.obj_from_primitive(x) for x in value]"},{"line_number":383,"context_line":""},{"line_number":384,"context_line":""},{"line_number":385,"context_line":"class NovaObjectSerializer(nova.openstack.common.rpc.serializer.Serializer):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAPX%2F%2F5%2BM%3D","line":382,"updated":"2013-06-06 09:55:19.000000000","message":"Man, I just ran into a case where block device mapping lists are sliced... for API response limit.  And I realized that instance_list[0] won\u0027t work here either...   This makes slicing and indexing work:\n\nhttp://paste.openstack.org/show/38175/\n\nHowever... I wonder if we\u0027re taking the wrong approach with lists.  isinstance(foo, list) will be False.  I think maybe we should toy around with trying to make the mixin inherit from \u0027list\u0027...... Maybe.","commit_id":"15b4b1fe0b30dba30f3a284381e1e57e50f61c0b"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"217a6d31505318afaba81298f33790626679b02d","unresolved":false,"context_lines":[{"line_number":379,"context_line":"        return [x.obj_to_primitive() for x in self.objects]"},{"line_number":380,"context_line":""},{"line_number":381,"context_line":"    def _attr_objects_from_primitive(self, value):"},{"line_number":382,"context_line":"        return [NovaObject.obj_from_primitive(x) for x in value]"},{"line_number":383,"context_line":""},{"line_number":384,"context_line":""},{"line_number":385,"context_line":"class NovaObjectSerializer(nova.openstack.common.rpc.serializer.Serializer):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAPX%2F%2F5pE%3D","line":382,"in_reply_to":"AAAAPX%2F%2F5%2BM%3D","updated":"2013-06-06 13:32:43.000000000","message":"Or consider using http://docs.python.org/2/library/collections.html#collections.MutableSequence as it is maybe a cleaner way to do it.","commit_id":"15b4b1fe0b30dba30f3a284381e1e57e50f61c0b"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"d20218855cb0eb263b6ff1f4d1983c2f290d474f","unresolved":false,"context_lines":[{"line_number":379,"context_line":"        return [x.obj_to_primitive() for x in self.objects]"},{"line_number":380,"context_line":""},{"line_number":381,"context_line":"    def _attr_objects_from_primitive(self, value):"},{"line_number":382,"context_line":"        return [NovaObject.obj_from_primitive(x) for x in value]"},{"line_number":383,"context_line":""},{"line_number":384,"context_line":""},{"line_number":385,"context_line":"class NovaObjectSerializer(nova.openstack.common.rpc.serializer.Serializer):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAPX%2F%2F5oI%3D","line":382,"in_reply_to":"AAAAPX%2F%2F5%2BM%3D","updated":"2013-06-06 13:37:59.000000000","message":"So, definitely agree on getitem, slice, etc. However, I think that inheriting from list is rather disliked, and that users of these objects should be duck typing instead of checking isinstance(list).","commit_id":"15b4b1fe0b30dba30f3a284381e1e57e50f61c0b"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"fa390236691f2449bb0d5c29fa53016b058c252f","unresolved":false,"context_lines":[{"line_number":379,"context_line":"        return [x.obj_to_primitive() for x in self.objects]"},{"line_number":380,"context_line":""},{"line_number":381,"context_line":"    def _attr_objects_from_primitive(self, value):"},{"line_number":382,"context_line":"        return [NovaObject.obj_from_primitive(x) for x in value]"},{"line_number":383,"context_line":""},{"line_number":384,"context_line":""},{"line_number":385,"context_line":"class NovaObjectSerializer(nova.openstack.common.rpc.serializer.Serializer):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAPX%2F%2F5dA%3D","line":382,"in_reply_to":"AAAAPX%2F%2F5fw%3D","updated":"2013-06-06 14:45:04.000000000","message":"\u003ctroll\u003eWell technically we could if we made the NovaObjectMetaclass inherit for ABC Metaclass\u003c/troll\u003e :)\n\nAgreed - in this case it would be an unnecessary complication.","commit_id":"15b4b1fe0b30dba30f3a284381e1e57e50f61c0b"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"eded363a084947f8ab3a381f1bec47841d30cf84","unresolved":false,"context_lines":[{"line_number":379,"context_line":"        return [x.obj_to_primitive() for x in self.objects]"},{"line_number":380,"context_line":""},{"line_number":381,"context_line":"    def _attr_objects_from_primitive(self, value):"},{"line_number":382,"context_line":"        return [NovaObject.obj_from_primitive(x) for x in value]"},{"line_number":383,"context_line":""},{"line_number":384,"context_line":""},{"line_number":385,"context_line":"class NovaObjectSerializer(nova.openstack.common.rpc.serializer.Serializer):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAPX%2F%2F5fw%3D","line":382,"in_reply_to":"AAAAPX%2F%2F5ik%3D","updated":"2013-06-06 14:27:45.000000000","message":"Yep, you\u0027re right about the slice, I hadn\u0027t had my coffee yet. However, there\u0027s another complication. Since we\u0027re already using a metaclass for NovaObject, we can\u0027t inherit from another class that also has a metaclass apparently, which the collections ABCs do.","commit_id":"15b4b1fe0b30dba30f3a284381e1e57e50f61c0b"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"1a00775c7602e1c0010f0aedbcf21088461af398","unresolved":false,"context_lines":[{"line_number":379,"context_line":"        return [x.obj_to_primitive() for x in self.objects]"},{"line_number":380,"context_line":""},{"line_number":381,"context_line":"    def _attr_objects_from_primitive(self, value):"},{"line_number":382,"context_line":"        return [NovaObject.obj_from_primitive(x) for x in value]"},{"line_number":383,"context_line":""},{"line_number":384,"context_line":""},{"line_number":385,"context_line":"class NovaObjectSerializer(nova.openstack.common.rpc.serializer.Serializer):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAPX%2F%2F5ik%3D","line":382,"in_reply_to":"AAAAPX%2F%2F5no%3D","updated":"2013-06-06 14:17:37.000000000","message":"Regarding slicing - you are right - slice would still need to be done through __getitem__ like in Chris\u0027s sample in comment one.\n\nThe idea of these ABCs is that you would get some stuff for free by just re-implementing __getitem__ and __len__ (in case of sequence _contains__, __iter__, __reversed__, index, and count), and all the isinstance and similar checks (which I too don\u0027t like) would work as though it were a list (you could see more in the \u0027collections\u0027 docs and abc module docs).\n\nIf we want to be \u0027quacking\u0027 like a list - then this would be the most \u0027pythonic\u0027 way to go - but definitely not a huge deal as there are examples of us not doing it in the code (including sqlalchmey models) that work fine without this.","commit_id":"15b4b1fe0b30dba30f3a284381e1e57e50f61c0b"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"f3ea58f702d115d6702c824b6f7db3e82d7cb7fa","unresolved":false,"context_lines":[{"line_number":379,"context_line":"        return [x.obj_to_primitive() for x in self.objects]"},{"line_number":380,"context_line":""},{"line_number":381,"context_line":"    def _attr_objects_from_primitive(self, value):"},{"line_number":382,"context_line":"        return [NovaObject.obj_from_primitive(x) for x in value]"},{"line_number":383,"context_line":""},{"line_number":384,"context_line":""},{"line_number":385,"context_line":"class NovaObjectSerializer(nova.openstack.common.rpc.serializer.Serializer):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAPX%2F%2F5no%3D","line":382,"in_reply_to":"AAAAPX%2F%2F5oI%3D","updated":"2013-06-06 13:42:16.000000000","message":"Nikola - it would need to be Sequence as these lists should be immutable. However, those don\u0027t have the slice functions, as far as I can tell. Regardless, checking against those base classes is more obscure than just trying to use these objects as lists. I don\u0027t think that there is any case where we may have one of these lists or something else (non-listy) so I don\u0027t think it\u0027s a huge deal.","commit_id":"15b4b1fe0b30dba30f3a284381e1e57e50f61c0b"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"94be3f0660f417541e6e88d9c16a22c3655a3dd2","unresolved":false,"context_lines":[{"line_number":383,"context_line":"            new_obj \u003d self.__class__()"},{"line_number":384,"context_line":"            new_obj.objects \u003d self.objects[index]"},{"line_number":385,"context_line":"            # NOTE(danms): We must be mixed in with a NovaObject!"},{"line_number":386,"context_line":"            new_obj.obj_reset_changes()"},{"line_number":387,"context_line":"            new_obj._context \u003d self._context"},{"line_number":388,"context_line":"            return new_obj"},{"line_number":389,"context_line":"        return self.objects[index]"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAPX%2F%2Fubc%3D","line":386,"updated":"2013-06-11 21:00:42.000000000","message":"This line is making me feel like I\u0027m missing, or not understanding, something.  As far as I can tell _changed_fields won\u0027t really come into play since InstanceList in the next patchset doesn\u0027t have a save() method.\n\nI can kind of see it as a protection in case of a future save method, but I can\u0027t easily see how save() makes sense for a list so maybe just a no-op or error raising save() on InstanceList would be better?","commit_id":"65f6c536fecd3c788b2e0dfa9d66ecd24ca550e1"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"9beadc2c5a4d4da752c6b0f17b0e3b85f3c5f1af","unresolved":false,"context_lines":[{"line_number":383,"context_line":"            new_obj \u003d self.__class__()"},{"line_number":384,"context_line":"            new_obj.objects \u003d self.objects[index]"},{"line_number":385,"context_line":"            # NOTE(danms): We must be mixed in with a NovaObject!"},{"line_number":386,"context_line":"            new_obj.obj_reset_changes()"},{"line_number":387,"context_line":"            new_obj._context \u003d self._context"},{"line_number":388,"context_line":"            return new_obj"},{"line_number":389,"context_line":"        return self.objects[index]"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAPX%2F%2FuS0%3D","line":386,"in_reply_to":"AAAAPX%2F%2FuZw%3D","updated":"2013-06-11 21:55:54.000000000","message":"Gotcha.  That makes sense, thanks.","commit_id":"65f6c536fecd3c788b2e0dfa9d66ecd24ca550e1"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"c866a7ce4465343dffe6ac59e35de040455cf643","unresolved":false,"context_lines":[{"line_number":383,"context_line":"            new_obj \u003d self.__class__()"},{"line_number":384,"context_line":"            new_obj.objects \u003d self.objects[index]"},{"line_number":385,"context_line":"            # NOTE(danms): We must be mixed in with a NovaObject!"},{"line_number":386,"context_line":"            new_obj.obj_reset_changes()"},{"line_number":387,"context_line":"            new_obj._context \u003d self._context"},{"line_number":388,"context_line":"            return new_obj"},{"line_number":389,"context_line":"        return self.objects[index]"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAPX%2F%2FuZw%3D","line":386,"in_reply_to":"AAAAPX%2F%2Fubc%3D","updated":"2013-06-11 21:09:26.000000000","message":"Well, someone could call what_changed() on the slice that we return, and reporting that objects has changed would be wrong, since it\u0027s not the case. Since we set the object list in the slice on the line above, it *would* be listed in what_changed() unless we did this reset.\n\nIn reality, none of the lists-of-objects entities we expect to support will ever be mutable*, so a foo.what_changed() returning anything would be an error condition. The quoted line is there to ensure that a slice doesn\u0027t appear to be modified for some reason. I think this makes it look \"clean\" to the user, and is the right thing to do in this case.\n\n*: meaning, you can\u0027t just create an instance by inserting one into an InstanceList.","commit_id":"65f6c536fecd3c788b2e0dfa9d66ecd24ca550e1"}]}
