)]}'
{"oslo_versionedobjects/fields.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"77853fcaae8152373878e3a5524610153b1fd96d","unresolved":false,"context_lines":[{"line_number":716,"context_line":"            ERROR: {"},{"line_number":717,"context_line":"                PENDING,"},{"line_number":718,"context_line":"            }"},{"line_number":719,"context_line":"        }"},{"line_number":720,"context_line":""},{"line_number":721,"context_line":"        _TYPES \u003d (ACTIVE, PENDING, ERROR)"},{"line_number":722,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"9a68dd71_83020d6e","line":719,"updated":"2016-01-22 03:06:36.000000000","message":"Can you update this example to add a terminal state, please? Currently, there\u0027s no terminal states defined in this example and therefore it\u0027s unclear to the reader/user how they should define them. For instance, if ERROR was a terminal state, should ALLOWED_TRANSITIONS have an ERROR key? If so, what should the key\u0027s value be? None? An empty dict?","commit_id":"9b71b2335083ad0c91f2d4f198d9136ed0ce615b"},{"author":{"_account_id":8099,"name":"Graham Hayes","email":"gr@ham.ie","username":"graham"},"change_message_id":"0910583c523c243591233e3154e918d97d1bbaa0","unresolved":false,"context_lines":[{"line_number":716,"context_line":"            ERROR: {"},{"line_number":717,"context_line":"                PENDING,"},{"line_number":718,"context_line":"            }"},{"line_number":719,"context_line":"        }"},{"line_number":720,"context_line":""},{"line_number":721,"context_line":"        _TYPES \u003d (ACTIVE, PENDING, ERROR)"},{"line_number":722,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"9a68dd71_171625f1","line":719,"updated":"2016-01-22 21:34:06.000000000","message":"Updated the example.\n\nIt was an empty dict - I took it out when I copied it from the Kosmos fields.py to make the example less complicated - but I should have left it in.\n\nI looked at the library - it looks interesting, but a little over kill for what we are doing here - we do not need (and should not do) transition methods. I do like the rendering - I might look at taking some of that over in the future.","commit_id":"9b71b2335083ad0c91f2d4f198d9136ed0ce615b"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"154bf9e66ad8a6f759f977df479d84afba5136fa","unresolved":false,"context_lines":[{"line_number":716,"context_line":"            ERROR: {"},{"line_number":717,"context_line":"                PENDING,"},{"line_number":718,"context_line":"            }"},{"line_number":719,"context_line":"        }"},{"line_number":720,"context_line":""},{"line_number":721,"context_line":"        _TYPES \u003d (ACTIVE, PENDING, ERROR)"},{"line_number":722,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"9a68dd71_bd0b858d","line":719,"in_reply_to":"9a68dd71_83020d6e","updated":"2016-01-22 17:16:13.000000000","message":"Good point jay,\n\nI wonder if at some point this should just use http://docs.openstack.org/developer/automaton/ for the internal storage format that. Because it does support all those things u are stating (terminal states, ...), at what point do u want to continue expanding the dict here and just switch to using that library in the first place (because at some point u put so much stuff in this dict that u create the same library, lol).","commit_id":"9b71b2335083ad0c91f2d4f198d9136ed0ce615b"},{"author":{"_account_id":8099,"name":"Graham Hayes","email":"gr@ham.ie","username":"graham"},"change_message_id":"0910583c523c243591233e3154e918d97d1bbaa0","unresolved":false,"context_lines":[{"line_number":731,"context_line":""},{"line_number":732,"context_line":"    def coerce(self, obj, attr, value):"},{"line_number":733,"context_line":"        super(StateMachine, self).coerce(obj, attr, value)"},{"line_number":734,"context_line":"        msg \u003d _(\"%(object)s\u0027s are not allowed transition out of %(value)s \""},{"line_number":735,"context_line":"                \"state\")"},{"line_number":736,"context_line":"        # olso.versionedobjects do not create the field until it is first used"},{"line_number":737,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":1,"id":"9a68dd71_b7d5d91c","line":734,"updated":"2016-01-22 21:34:06.000000000","message":"Done.\n\nIt is used below - the string interpolation drops extra keys when using named values for insertion","commit_id":"9b71b2335083ad0c91f2d4f198d9136ed0ce615b"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"77853fcaae8152373878e3a5524610153b1fd96d","unresolved":false,"context_lines":[{"line_number":731,"context_line":""},{"line_number":732,"context_line":"    def coerce(self, obj, attr, value):"},{"line_number":733,"context_line":"        super(StateMachine, self).coerce(obj, attr, value)"},{"line_number":734,"context_line":"        msg \u003d _(\"%(object)s\u0027s are not allowed transition out of %(value)s \""},{"line_number":735,"context_line":"                \"state\")"},{"line_number":736,"context_line":"        # olso.versionedobjects do not create the field until it is first used"},{"line_number":737,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":1,"id":"9a68dd71_23fa4176","line":734,"updated":"2016-01-22 03:06:36.000000000","message":"s/allowed transition/allowed to transition/\n\nAlso, I fail to see where this msg variable is used in this method? It cannot be used below on line 751 because that would lead to an exception regarding wrong number of interpolated arguments...","commit_id":"9b71b2335083ad0c91f2d4f198d9136ed0ce615b"},{"author":{"_account_id":8099,"name":"Graham Hayes","email":"gr@ham.ie","username":"graham"},"change_message_id":"0910583c523c243591233e3154e918d97d1bbaa0","unresolved":false,"context_lines":[{"line_number":733,"context_line":"        super(StateMachine, self).coerce(obj, attr, value)"},{"line_number":734,"context_line":"        msg \u003d _(\"%(object)s\u0027s are not allowed transition out of %(value)s \""},{"line_number":735,"context_line":"                \"state\")"},{"line_number":736,"context_line":"        # olso.versionedobjects do not create the field until it is first used"},{"line_number":737,"context_line":"        try:"},{"line_number":738,"context_line":"            current_value \u003d getattr(obj, attr)"},{"line_number":739,"context_line":"        except NotImplementedError:"}],"source_content_type":"text/x-python","patch_set":1,"id":"9a68dd71_d7dacd4b","line":736,"updated":"2016-01-22 21:34:06.000000000","message":"Removed","commit_id":"9b71b2335083ad0c91f2d4f198d9136ed0ce615b"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"77853fcaae8152373878e3a5524610153b1fd96d","unresolved":false,"context_lines":[{"line_number":733,"context_line":"        super(StateMachine, self).coerce(obj, attr, value)"},{"line_number":734,"context_line":"        msg \u003d _(\"%(object)s\u0027s are not allowed transition out of %(value)s \""},{"line_number":735,"context_line":"                \"state\")"},{"line_number":736,"context_line":"        # olso.versionedobjects do not create the field until it is first used"},{"line_number":737,"context_line":"        try:"},{"line_number":738,"context_line":"            current_value \u003d getattr(obj, attr)"},{"line_number":739,"context_line":"        except NotImplementedError:"}],"source_content_type":"text/x-python","patch_set":1,"id":"9a68dd71_43f5f580","line":736,"updated":"2016-01-22 03:06:36.000000000","message":"s/do not/does not/","commit_id":"9b71b2335083ad0c91f2d4f198d9136ed0ce615b"},{"author":{"_account_id":11803,"name":"Ryan Rossiter","email":"rlrossit@us.ibm.com","username":"rlrossiter"},"change_message_id":"4063876bfed7ea4d2cc032b585939c0ee58cc612","unresolved":false,"context_lines":[{"line_number":733,"context_line":"        super(StateMachine, self).coerce(obj, attr, value)"},{"line_number":734,"context_line":"        msg \u003d _(\"%(object)s\u0027s are not allowed transition out of %(value)s \""},{"line_number":735,"context_line":"                \"state\")"},{"line_number":736,"context_line":"        # olso.versionedobjects do not create the field until it is first used"},{"line_number":737,"context_line":"        try:"},{"line_number":738,"context_line":"            current_value \u003d getattr(obj, attr)"},{"line_number":739,"context_line":"        except NotImplementedError:"}],"source_content_type":"text/x-python","patch_set":1,"id":"9a68dd71_d9e2162f","line":736,"in_reply_to":"9a68dd71_43f5f580","updated":"2016-01-22 14:48:19.000000000","message":"This comment is kinda incorrect. o.vo doesn\u0027t get the field until it is first attempted (i.e. it\u0027s lazy-loaded).","commit_id":"9b71b2335083ad0c91f2d4f198d9136ed0ce615b"},{"author":{"_account_id":8099,"name":"Graham Hayes","email":"gr@ham.ie","username":"graham"},"change_message_id":"0910583c523c243591233e3154e918d97d1bbaa0","unresolved":false,"context_lines":[{"line_number":736,"context_line":"        # olso.versionedobjects do not create the field until it is first used"},{"line_number":737,"context_line":"        try:"},{"line_number":738,"context_line":"            current_value \u003d getattr(obj, attr)"},{"line_number":739,"context_line":"        except NotImplementedError:"},{"line_number":740,"context_line":"            return value"},{"line_number":741,"context_line":""},{"line_number":742,"context_line":"        if current_value in self.ALLOWED_TRANSITIONS:"}],"source_content_type":"text/x-python","patch_set":1,"id":"9a68dd71_77dbe14f","line":739,"updated":"2016-01-22 21:34:06.000000000","message":"Done","commit_id":"9b71b2335083ad0c91f2d4f198d9136ed0ce615b"},{"author":{"_account_id":11803,"name":"Ryan Rossiter","email":"rlrossit@us.ibm.com","username":"rlrossiter"},"change_message_id":"4063876bfed7ea4d2cc032b585939c0ee58cc612","unresolved":false,"context_lines":[{"line_number":736,"context_line":"        # olso.versionedobjects do not create the field until it is first used"},{"line_number":737,"context_line":"        try:"},{"line_number":738,"context_line":"            current_value \u003d getattr(obj, attr)"},{"line_number":739,"context_line":"        except NotImplementedError:"},{"line_number":740,"context_line":"            return value"},{"line_number":741,"context_line":""},{"line_number":742,"context_line":"        if current_value in self.ALLOWED_TRANSITIONS:"}],"source_content_type":"text/x-python","patch_set":1,"id":"9a68dd71_792e8a44","line":739,"updated":"2016-01-22 14:48:19.000000000","message":"a more readable way of doing this is to use the object\u0027s __contains__() method, which checks to see if the field is set (which allows you to use getattr(). It looks a lot cleaner than using try/except:\n\n    if attr in obj:\n        current_value \u003d getattr(obj, attr)\n    else:\n        return value","commit_id":"9b71b2335083ad0c91f2d4f198d9136ed0ce615b"}]}
