)]}'
{"neutron/objects/qos/policy.py":[{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"e5dc4024f8f4eab61ac6d2f9f50417111ff60044","unresolved":false,"context_lines":[{"line_number":393,"context_line":"            primitive.pop(\u0027is_default\u0027, None)"},{"line_number":394,"context_line":""},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"def get_policy_obj(context, policy_id):"},{"line_number":397,"context_line":"    \"\"\"Fetch a QoS policy."},{"line_number":398,"context_line":""},{"line_number":399,"context_line":"    :param context: neutron api request context"},{"line_number":400,"context_line":"    :type context: neutron.context.Context"},{"line_number":401,"context_line":"    :param policy_id: the id of the QosPolicy to fetch"},{"line_number":402,"context_line":"    :type policy_id: str uuid"},{"line_number":403,"context_line":""},{"line_number":404,"context_line":"    :returns: a QosPolicy object"},{"line_number":405,"context_line":"    :raises: n_exc.QosPolicyNotFound"},{"line_number":406,"context_line":"    \"\"\""},{"line_number":407,"context_line":"    obj \u003d QosPolicy.get_object(context, id\u003dpolicy_id)"},{"line_number":408,"context_line":"    if obj is None:"},{"line_number":409,"context_line":"        raise exceptions.QosPolicyNotFound(policy_id\u003dpolicy_id)"},{"line_number":410,"context_line":"    return obj"},{"line_number":411,"context_line":""},{"line_number":412,"context_line":""},{"line_number":413,"context_line":"@base_db.NeutronObjectRegistry.register"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_6b9fdcb3","line":410,"range":{"start_line":396,"start_character":0,"end_line":410,"end_character":14},"updated":"2018-06-11 16:34:16.000000000","message":"can be under class QoSPolicy since there no global methods in this module ?\n\nand access it as policy.QoSpolicy.get_policy_obj to other modules.","commit_id":"0ccf32543b76e3190faa6fd0f2c2ebc6ecff3606"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"2bb04184b595c2162588c62f0cbfa942a54a7206","unresolved":false,"context_lines":[{"line_number":393,"context_line":"            primitive.pop(\u0027is_default\u0027, None)"},{"line_number":394,"context_line":""},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"def get_policy_obj(context, policy_id):"},{"line_number":397,"context_line":"    \"\"\"Fetch a QoS policy."},{"line_number":398,"context_line":""},{"line_number":399,"context_line":"    :param context: neutron api request context"},{"line_number":400,"context_line":"    :type context: neutron.context.Context"},{"line_number":401,"context_line":"    :param policy_id: the id of the QosPolicy to fetch"},{"line_number":402,"context_line":"    :type policy_id: str uuid"},{"line_number":403,"context_line":""},{"line_number":404,"context_line":"    :returns: a QosPolicy object"},{"line_number":405,"context_line":"    :raises: n_exc.QosPolicyNotFound"},{"line_number":406,"context_line":"    \"\"\""},{"line_number":407,"context_line":"    obj \u003d QosPolicy.get_object(context, id\u003dpolicy_id)"},{"line_number":408,"context_line":"    if obj is None:"},{"line_number":409,"context_line":"        raise exceptions.QosPolicyNotFound(policy_id\u003dpolicy_id)"},{"line_number":410,"context_line":"    return obj"},{"line_number":411,"context_line":""},{"line_number":412,"context_line":""},{"line_number":413,"context_line":"@base_db.NeutronObjectRegistry.register"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_a683e255","line":410,"range":{"start_line":396,"start_character":0,"end_line":410,"end_character":14},"in_reply_to":"5f7c97a3_6b9fdcb3","updated":"2018-06-12 01:31:22.000000000","message":"Actually the QosPolicy `get_object` function already act as the user interface. For the qos_fip, qos_plugin they just have the same code there, catch the None and raise the NotFound. Add a new `get_policy_obj` to the class is duplicated to that `get_object` function. So if put such function here dose not satify you, maybe I can put it to another file, such as common.utils. But such move may break the code scope of qos policy.\n\nThere is no global function here, so we can start one. Does this make sence to you?","commit_id":"0ccf32543b76e3190faa6fd0f2c2ebc6ecff3606"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"6ddb3e3564b616facb31a7a500890e2c1378422f","unresolved":false,"context_lines":[{"line_number":393,"context_line":"            primitive.pop(\u0027is_default\u0027, None)"},{"line_number":394,"context_line":""},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"def get_policy_obj(context, policy_id):"},{"line_number":397,"context_line":"    \"\"\"Fetch a QoS policy."},{"line_number":398,"context_line":""},{"line_number":399,"context_line":"    :param context: neutron api request context"},{"line_number":400,"context_line":"    :type context: neutron.context.Context"},{"line_number":401,"context_line":"    :param policy_id: the id of the QosPolicy to fetch"},{"line_number":402,"context_line":"    :type policy_id: str uuid"},{"line_number":403,"context_line":""},{"line_number":404,"context_line":"    :returns: a QosPolicy object"},{"line_number":405,"context_line":"    :raises: n_exc.QosPolicyNotFound"},{"line_number":406,"context_line":"    \"\"\""},{"line_number":407,"context_line":"    obj \u003d QosPolicy.get_object(context, id\u003dpolicy_id)"},{"line_number":408,"context_line":"    if obj is None:"},{"line_number":409,"context_line":"        raise exceptions.QosPolicyNotFound(policy_id\u003dpolicy_id)"},{"line_number":410,"context_line":"    return obj"},{"line_number":411,"context_line":""},{"line_number":412,"context_line":""},{"line_number":413,"context_line":"@base_db.NeutronObjectRegistry.register"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_27649e21","line":410,"range":{"start_line":396,"start_character":0,"end_line":410,"end_character":14},"in_reply_to":"5f7c97a3_a683e255","updated":"2018-06-12 15:46:28.000000000","message":"it can be another user interface ? by using get_object from native class ? if you decide to keep it global then i guess move it to something like utils.","commit_id":"0ccf32543b76e3190faa6fd0f2c2ebc6ecff3606"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"ee74605597d92315cbc4e382b255ed8ee8565dd2","unresolved":false,"context_lines":[{"line_number":393,"context_line":"            primitive.pop(\u0027is_default\u0027, None)"},{"line_number":394,"context_line":""},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"def get_policy_obj(context, policy_id):"},{"line_number":397,"context_line":"    \"\"\"Fetch a QoS policy."},{"line_number":398,"context_line":""},{"line_number":399,"context_line":"    :param context: neutron api request context"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_9ebb4a0d","line":396,"updated":"2018-06-14 12:02:42.000000000","message":"can\u0027t it just be done as overloaded class method, something like:\n\n    def get_object(self, context, id):\n        obj \u003d super(QosPolicy, self).get_object(context, id)\n        if obj is None:\n            raise exceptions.QosPolicyNotFound(policy_id\u003dpolicy_id)\n    return obj\n\nor something like that?","commit_id":"fc9fc97e71bcaf9e209e8d23c92b85d405523b7d"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"1e0b9d6e5625af3cfd032e90f9b1d928cfda94d3","unresolved":false,"context_lines":[{"line_number":393,"context_line":"            primitive.pop(\u0027is_default\u0027, None)"},{"line_number":394,"context_line":""},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"def get_policy_obj(context, policy_id):"},{"line_number":397,"context_line":"    \"\"\"Fetch a QoS policy."},{"line_number":398,"context_line":""},{"line_number":399,"context_line":"    :param context: neutron api request context"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_affe05ad","line":396,"in_reply_to":"5f7c97a3_58270120","updated":"2018-06-14 20:20:31.000000000","message":"Maybe I\u0027m missing something (then sorry) but IMHO it\u0027s not so big problem.\nTo get policy obj You need then do:\n\n    policy_obj.QosPolicy.get_object()\n\ninstead of:\n\n    policy_obj.get_policy_obj()\n\nand that\u0027s it. AFAIK get_object() is class method already.\nAnd about RBAC, You will not lost anything if You first call super.get_object() as this will handle all what it handles now.","commit_id":"fc9fc97e71bcaf9e209e8d23c92b85d405523b7d"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"3f6bc1234bcf6bfe6b0b3ea737d942e64a74c7ee","unresolved":false,"context_lines":[{"line_number":393,"context_line":"            primitive.pop(\u0027is_default\u0027, None)"},{"line_number":394,"context_line":""},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"def get_policy_obj(context, policy_id):"},{"line_number":397,"context_line":"    \"\"\"Fetch a QoS policy."},{"line_number":398,"context_line":""},{"line_number":399,"context_line":"    :param context: neutron api request context"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_58270120","line":396,"in_reply_to":"5f7c97a3_7731b1a1","updated":"2018-06-14 16:45:45.000000000","message":"anyway you\u0027re calling get_policy_obj that in turn is calling get_object classmethod, which is overriding the context to use admin context, I don\u0027t think it can\u0027t be modified, you can modify existing get_object, just add a try catch after super get_object and return accordingly, actual get_object is not much used only couple of modules, so adapting that new change won\u0027t be that bad either ?","commit_id":"fc9fc97e71bcaf9e209e8d23c92b85d405523b7d"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"6c2c2199af253edf4d3173e471de4465764bf2fc","unresolved":false,"context_lines":[{"line_number":393,"context_line":"            primitive.pop(\u0027is_default\u0027, None)"},{"line_number":394,"context_line":""},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"def get_policy_obj(context, policy_id):"},{"line_number":397,"context_line":"    \"\"\"Fetch a QoS policy."},{"line_number":398,"context_line":""},{"line_number":399,"context_line":"    :param context: neutron api request context"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_7731b1a1","line":396,"in_reply_to":"5f7c97a3_9ebb4a0d","updated":"2018-06-14 14:02:20.000000000","message":"This is method does not stay in any class, so super cannot use.\nAnd put such overloaded method to the QoSPolicy class, then the client side will need a QoSPolicy object first, and then a classmethod decorator is needed. Finally, it became duplicated to the original method.\n\nAgain, I do not want add a duplicated method to the QoSPolicy class. And I will not move this method to the utils, since we will not break the qos policy code scope, and do not need to import the utils to all the related file.\n\n\nWhy not rewrite the QoSPolicy.get_object? IMO, there are some RBAC check, I do not want touch. Let\u0027s make the change small.\n\nIMO, this is the minimal change.","commit_id":"fc9fc97e71bcaf9e209e8d23c92b85d405523b7d"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"8fc946258cb0d5265ec661eaacc71e8d2c7690ed","unresolved":false,"context_lines":[{"line_number":393,"context_line":"            primitive.pop(\u0027is_default\u0027, None)"},{"line_number":394,"context_line":""},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"def get_policy_obj(context, policy_id):"},{"line_number":397,"context_line":"    \"\"\"Fetch a QoS policy."},{"line_number":398,"context_line":""},{"line_number":399,"context_line":"    :param context: neutron api request context"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_11aa7619","line":396,"in_reply_to":"5f7c97a3_affe05ad","updated":"2018-06-19 09:06:12.000000000","message":"Move this method to the QosPolicy class with a new classmethod.","commit_id":"fc9fc97e71bcaf9e209e8d23c92b85d405523b7d"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"d86707e84791ed8c86941330177be74b6eb14321","unresolved":false,"context_lines":[{"line_number":138,"context_line":"        :raises: n_exc.QosPolicyNotFound"},{"line_number":139,"context_line":"        \"\"\""},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"        obj \u003d cls.get_object(context, id\u003dpolicy_id)"},{"line_number":142,"context_line":"        if obj is None:"},{"line_number":143,"context_line":"            raise exceptions.QosPolicyNotFound(policy_id\u003dpolicy_id)"},{"line_number":144,"context_line":"        return obj"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_7a9b7fc7","line":141,"updated":"2018-06-19 10:29:08.000000000","message":"I think it should be:\n\n    obj \u003d super(QosPolicy, cls).get_object(context, id\u003dpolicy_id)\n\nno?","commit_id":"ae80872e8024b6e01a760d4e09c0900ab6e60706"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"8988215bcccdcfbf7d8878e3b602eaa215e8e1d8","unresolved":false,"context_lines":[{"line_number":138,"context_line":"        :raises: n_exc.QosPolicyNotFound"},{"line_number":139,"context_line":"        \"\"\""},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"        obj \u003d cls.get_object(context, id\u003dpolicy_id)"},{"line_number":142,"context_line":"        if obj is None:"},{"line_number":143,"context_line":"            raise exceptions.QosPolicyNotFound(policy_id\u003dpolicy_id)"},{"line_number":144,"context_line":"        return obj"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_fad46f4d","line":141,"in_reply_to":"5f7c97a3_7a9b7fc7","updated":"2018-06-19 10:31:46.000000000","message":"The get_object is downstairs Line 146-160.","commit_id":"ae80872e8024b6e01a760d4e09c0900ab6e60706"}]}
