)]}'
{"neutron/tests/fullstack/resources/client.py":[{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"0c3d2b2f454eb005dbbe2bf727e440cf772e21c4","unresolved":false,"context_lines":[{"line_number":15,"context_line":"import functools"},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"from neutronclient.common import exceptions"},{"line_number":18,"context_line":"import fixtures"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"from neutron.tests import base"},{"line_number":21,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"fa1b9901_17f74ef6","line":18,"updated":"2015-08-18 15:14:29.000000000","message":"F is earlier in alphabet than N? Damn :(","commit_id":"a34d3c700b32521202ddb6fa631a7929dad323cb"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"fae3e18fb44c264578e6995a0687b0b480a80cca","unresolved":false,"context_lines":[{"line_number":37,"context_line":"        super(ClientFixture, self).__init__()"},{"line_number":38,"context_line":"        self.client \u003d client"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    def addCleanup(self, method, *args, **kwargs):"},{"line_number":41,"context_line":"        safe_method \u003d _safe_method(method)"},{"line_number":42,"context_line":"        super(ClientFixture, self).addCleanup(safe_method, *args, **kwargs)"},{"line_number":43,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"fa1b9901_e2ca136e","line":40,"updated":"2015-08-18 16:35:48.000000000","message":"I think you can simplify by defining safeDelete that accepts f, *args and **kwargs and calls it while catching NotFound. Then in _create_resource you call self.addCleanup(self.safeDelete, data[\u0027id\u0027]) and in create_bandwidth_limit_rule you call it with the additional policy ID.\n\nThe advantage is that you don\u0027t have to define the wrapper in line 23, the disadvantage is that any new create method will have to know to use self.addCleanup with self.safeDelete and that it won\u0027t be automatic like you did here with overriding addCleanup. I\u0027m not in love with the idea of overriding addCleanup and I think that any new create method people will just copy/paste something else in this file anyway so overall I like my suggestion better.","commit_id":"d454a2dad33e53237b87f34d9143c32272ea4fe7"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"f77871a86207d1f0e005d55ae6ac16188f91d9e5","unresolved":false,"context_lines":[{"line_number":37,"context_line":"        super(ClientFixture, self).__init__()"},{"line_number":38,"context_line":"        self.client \u003d client"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    def addCleanup(self, method, *args, **kwargs):"},{"line_number":41,"context_line":"        safe_method \u003d _safe_method(method)"},{"line_number":42,"context_line":"        super(ClientFixture, self).addCleanup(safe_method, *args, **kwargs)"},{"line_number":43,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"fa1b9901_e2fe9337","line":40,"updated":"2015-08-18 16:45:16.000000000","message":"i would prefer not to overload addCleanup and replace L51 by:\n\n self.addCleanup(_safe_method(delete), data[\u0027id\u0027])\n # or self.addCleanup(_safe_method, delete, data[\u0027id\u0027])\n # as we no more need a decorator\n\nwhich avoids to change addCleanup behavior and allows in the future to have different/no safe_methods depending on _create_resource arguments (resource_type, ...).","commit_id":"d454a2dad33e53237b87f34d9143c32272ea4fe7"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"b8a9a2b1b347ccaf21e537449f7529863ca24b83","unresolved":false,"context_lines":[{"line_number":37,"context_line":"        super(ClientFixture, self).__init__()"},{"line_number":38,"context_line":"        self.client \u003d client"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    def addCleanup(self, method, *args, **kwargs):"},{"line_number":41,"context_line":"        safe_method \u003d _safe_method(method)"},{"line_number":42,"context_line":"        super(ClientFixture, self).addCleanup(safe_method, *args, **kwargs)"},{"line_number":43,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"fa1b9901_13643847","line":40,"in_reply_to":"fa1b9901_0e45f06e","updated":"2015-08-18 19:04:41.000000000","message":"simpler? IMO, it\u0027s not simpler to review nor maintain the code because you change addCleanup behavior and hides NotFound error handling. It\u0027s also not simpler to extend because safe_method is ALWAYS (not mostly) applied.","commit_id":"d454a2dad33e53237b87f34d9143c32272ea4fe7"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"b7255949e0de74dc981fd12c8db5715fddb5e022","unresolved":false,"context_lines":[{"line_number":37,"context_line":"        super(ClientFixture, self).__init__()"},{"line_number":38,"context_line":"        self.client \u003d client"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    def addCleanup(self, method, *args, **kwargs):"},{"line_number":41,"context_line":"        safe_method \u003d _safe_method(method)"},{"line_number":42,"context_line":"        super(ClientFixture, self).addCleanup(safe_method, *args, **kwargs)"},{"line_number":43,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"fa1b9901_0e45f06e","line":40,"in_reply_to":"fa1b9901_33a93fe0","updated":"2015-08-18 18:07:51.000000000","message":"Is there a justification for *not* overriding addCleanup()? I mean do we have an actual use case where we want to raise exception if resource is already gone?\n\nIf not then it\u0027s simpler to default to behaviour we use mostly in this class rather than explicitly calling wrapper on multiple places.\n\nRegarding to implementation of wrapper:\nThe fact we would implement a function that wraps function (which in Python is decorator) in C style doesn\u0027t bring any benefit here. And is just a matter of how you do it, but you always need to have a wrapper.","commit_id":"d454a2dad33e53237b87f34d9143c32272ea4fe7"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"a211062cff83b8bf60f85ec11a9103a4194d4007","unresolved":false,"context_lines":[{"line_number":37,"context_line":"        super(ClientFixture, self).__init__()"},{"line_number":38,"context_line":"        self.client \u003d client"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    def addCleanup(self, method, *args, **kwargs):"},{"line_number":41,"context_line":"        safe_method \u003d _safe_method(method)"},{"line_number":42,"context_line":"        super(ClientFixture, self).addCleanup(safe_method, *args, **kwargs)"},{"line_number":43,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"fa1b9901_33a93fe0","line":40,"in_reply_to":"fa1b9901_5dd4041f","updated":"2015-08-18 17:34:29.000000000","message":"Looks like i am really slow to write comments :)","commit_id":"d454a2dad33e53237b87f34d9143c32272ea4fe7"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"adf6ab855422337cd0259b5f79bdd9faa5f521d2","unresolved":false,"context_lines":[{"line_number":37,"context_line":"        super(ClientFixture, self).__init__()"},{"line_number":38,"context_line":"        self.client \u003d client"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    def addCleanup(self, method, *args, **kwargs):"},{"line_number":41,"context_line":"        safe_method \u003d _safe_method(method)"},{"line_number":42,"context_line":"        super(ClientFixture, self).addCleanup(safe_method, *args, **kwargs)"},{"line_number":43,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"fa1b9901_5dd4041f","line":40,"in_reply_to":"fa1b9901_e2fe9337","updated":"2015-08-18 16:53:16.000000000","message":"Looks like Cedric and I have the exact same idea.","commit_id":"d454a2dad33e53237b87f34d9143c32272ea4fe7"},{"author":{"_account_id":704,"name":"Edgar Magana","email":"emagana@gmail.com","username":"emagana"},"change_message_id":"248610d7dc2ed6d0b81fce1c342b3181e79b9c37","unresolved":false,"context_lines":[{"line_number":37,"context_line":"        super(ClientFixture, self).__init__()"},{"line_number":38,"context_line":"        self.client \u003d client"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    def addCleanup(self, method, *args, **kwargs):"},{"line_number":41,"context_line":"        safe_method \u003d _safe_method(method)"},{"line_number":42,"context_line":"        super(ClientFixture, self).addCleanup(safe_method, *args, **kwargs)"},{"line_number":43,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"fa1b9901_edf678f8","line":40,"in_reply_to":"fa1b9901_e2fe9337","updated":"2015-08-18 22:54:18.000000000","message":"Yes, indeed nicer approach!","commit_id":"d454a2dad33e53237b87f34d9143c32272ea4fe7"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"ffa4d42d25a128d8d5d5ff8a2a44ccdba9b7ed5f","unresolved":false,"context_lines":[{"line_number":37,"context_line":"        super(ClientFixture, self).__init__()"},{"line_number":38,"context_line":"        self.client \u003d client"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    def addCleanup(self, method, *args, **kwargs):"},{"line_number":41,"context_line":"        safe_method \u003d _safe_method(method)"},{"line_number":42,"context_line":"        super(ClientFixture, self).addCleanup(safe_method, *args, **kwargs)"},{"line_number":43,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"fa1b9901_74d221d4","line":40,"in_reply_to":"fa1b9901_edf678f8","updated":"2015-08-19 09:18:17.000000000","message":"Done","commit_id":"d454a2dad33e53237b87f34d9143c32272ea4fe7"}]}
