)]}'
{"openstack_dashboard/dashboards/admin/images/forms.py":[{"author":{"_account_id":11997,"name":"Lennart Regebro","email":"lregebro@redhat.com","username":"lregebro"},"change_message_id":"917764628f429fb60a9efb8d8288ed17512afd16","unresolved":false,"context_lines":[{"line_number":32,"context_line":""},{"line_number":33,"context_line":"class AdminCreateImageForm(images_forms.CreateImageForm):"},{"line_number":34,"context_line":"    failure_url \u003d \u0027horizon:admin:images:index\u0027"},{"line_number":35,"context_line":"    pass"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"class AdminUpdateImageForm(images_forms.UpdateImageForm):"}],"source_content_type":"text/x-python","patch_set":14,"id":"5a890539_1406ba20","line":35,"updated":"2014-11-20 10:00:38.000000000","message":"Nitpick: You don\u0027t need the pass here once you have the failure_url.","commit_id":"91095b46c2fdf1e38fe53819804066d1de1eca4c"},{"author":{"_account_id":13086,"name":"Yash Bathia","email":"ybathia@yahoo-inc.com","username":"ybathia"},"change_message_id":"9cd8fd9961f16b197b7084edabba9845a3e74f04","unresolved":false,"context_lines":[{"line_number":31,"context_line":""},{"line_number":32,"context_line":""},{"line_number":33,"context_line":"class AdminCreateImageForm(images_forms.CreateImageForm):"},{"line_number":34,"context_line":"    failure_url \u003d \u0027horizon:admin:images:index\u0027"},{"line_number":35,"context_line":"    pass"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":""}],"source_content_type":"text/x-python","patch_set":15,"id":"3a961159_2c220152","line":34,"updated":"2014-12-23 05:30:21.000000000","message":"You do not need the pass statement once you have failure_url","commit_id":"92d7acb48876bdc280d1537ab18b793270e98843"},{"author":{"_account_id":13161,"name":"Kamil Rykowski","email":"kamil.rykowski@gmail.com","username":"krykowski"},"change_message_id":"cb9b9a60eea075f5aa7c2d4abca4ac976f6ca613","unresolved":false,"context_lines":[{"line_number":32,"context_line":""},{"line_number":33,"context_line":"class AdminCreateImageForm(images_forms.CreateImageForm):"},{"line_number":34,"context_line":"    failure_url \u003d \u0027horizon:admin:images:index\u0027"},{"line_number":35,"context_line":"    pass"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"class AdminUpdateImageForm(images_forms.UpdateImageForm):"}],"source_content_type":"text/x-python","patch_set":19,"id":"3a961159_615a401f","line":35,"updated":"2015-01-08 14:23:41.000000000","message":"pass is redundant here","commit_id":"d50e9cbd13b2adfb2aa071b416530ca6bb2a87c2"}],"openstack_dashboard/dashboards/project/images/images/forms.py":[{"author":{"_account_id":2455,"name":"Tihomir Trifonov","email":"t.trifonov@gmail.com","username":"ttrifonov"},"change_message_id":"83e9016acb9f052198329be006e1c8733ba42489","unresolved":false,"context_lines":[{"line_number":189,"context_line":"                reason \u003d (e.details).replace(\"\\n\", \"\")"},{"line_number":190,"context_line":"                reason \u003d reason.split(\u0027\u003c/h1\u003e \u0027)[1].split(\u0027\u003cbr /\u003e\u0027, 1)[0]"},{"line_number":191,"context_line":"                reason \u003d reason.strip()"},{"line_number":192,"context_line":"                msg \u003d msg % (\": \" + reason)"},{"line_number":193,"context_line":"            else:"},{"line_number":194,"context_line":"                msg \u003d msg % reason"},{"line_number":195,"context_line":"            redirect \u003d reverse(self.failure_url)"}],"source_content_type":"text/x-python","patch_set":2,"id":"9aa7fdbe_8b7bb779","line":192,"updated":"2014-10-28 15:07:29.000000000","message":"Showing raw error message to user is not a good practice. Also, the raw message cannot be translated. A better approach is to check here for specific patterns in the exception details, and if a known pattern is found - return translatable message. Otherwise - return generic message.","commit_id":"78e3339ba7306531d7cd545af4aba108b897efa8"},{"author":{"_account_id":6825,"name":"Gary W. Smith","email":"garysmith123@gmail.com","username":"gary-w-smith"},"change_message_id":"aa9eca87155a3d284170da06df174c0337840f90","unresolved":false,"context_lines":[{"line_number":188,"context_line":"            if e.code \u003d\u003d 400:"},{"line_number":189,"context_line":"                reason \u003d _(\"Invalid disk format %s \""},{"line_number":190,"context_line":"                           \"for image.\") % data[\u0027disk_format\u0027]"},{"line_number":191,"context_line":"                msg \u003d msg % \": \""},{"line_number":192,"context_line":"                msg +\u003d reason"},{"line_number":193,"context_line":"            else:"},{"line_number":194,"context_line":"                msg \u003d msg % reason"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a890539_f6d688f0","line":191,"updated":"2014-11-12 14:29:43.000000000","message":"Sorry, it is 1369445","commit_id":"5772d11b7823bf7c44944822ac758bd6c0085f1c"},{"author":{"_account_id":6825,"name":"Gary W. Smith","email":"garysmith123@gmail.com","username":"gary-w-smith"},"change_message_id":"9b245e17a7e1a6e2b7f2122f8c33bc6f3682786a","unresolved":false,"context_lines":[{"line_number":188,"context_line":"            if e.code \u003d\u003d 400:"},{"line_number":189,"context_line":"                reason \u003d _(\"Invalid disk format %s \""},{"line_number":190,"context_line":"                           \"for image.\") % data[\u0027disk_format\u0027]"},{"line_number":191,"context_line":"                msg \u003d msg % \": \""},{"line_number":192,"context_line":"                msg +\u003d reason"},{"line_number":193,"context_line":"            else:"},{"line_number":194,"context_line":"                msg \u003d msg % reason"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a890539_d7dd1d16","line":191,"updated":"2014-11-11 22:31:42.000000000","message":"The colon and surrounding space needs to be handled in a translatable way.  See bug 1369455 for more info on that.","commit_id":"5772d11b7823bf7c44944822ac758bd6c0085f1c"},{"author":{"_account_id":11599,"name":"Nikunj Aggarwal","email":"nikunj.aggarwal@hp.com","username":"nikunj2512"},"change_message_id":"4b01da2c55bf0ebda06fcd86b19b6a82bb1b0484","unresolved":false,"context_lines":[{"line_number":188,"context_line":"            if e.code \u003d\u003d 400:"},{"line_number":189,"context_line":"                reason \u003d _(\"Invalid disk format %s \""},{"line_number":190,"context_line":"                           \"for image.\") % data[\u0027disk_format\u0027]"},{"line_number":191,"context_line":"                msg \u003d msg % \": \""},{"line_number":192,"context_line":"                msg +\u003d reason"},{"line_number":193,"context_line":"            else:"},{"line_number":194,"context_line":"                msg \u003d msg % reason"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a890539_8bb1a9e3","line":191,"in_reply_to":"5a890539_d7dd1d16","updated":"2014-11-12 05:02:31.000000000","message":"@Gary: I think so you gave wrong bug number.","commit_id":"5772d11b7823bf7c44944822ac758bd6c0085f1c"},{"author":{"_account_id":6825,"name":"Gary W. Smith","email":"garysmith123@gmail.com","username":"gary-w-smith"},"change_message_id":"1754e422464b5cb2f35a05f9869bd7ca147dedc7","unresolved":false,"context_lines":[{"line_number":188,"context_line":"            if e.code \u003d\u003d 400:"},{"line_number":189,"context_line":"                reason \u003d _(\" Invalid disk format %s \""},{"line_number":190,"context_line":"                           \"for image.\") % data[\u0027disk_format\u0027]"},{"line_number":191,"context_line":"                msg \u003d msg % _(\":\")"},{"line_number":192,"context_line":"                msg +\u003d reason"},{"line_number":193,"context_line":"            else:"},{"line_number":194,"context_line":"                msg \u003d msg % reason"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_d2bfcffa","line":191,"updated":"2014-11-12 18:17:06.000000000","message":"It is strange that the %s in msg is being populated with a colon in the \u0027if\u0027, and an empty reason in the \u0027else\u0027.   Simple concatenation of the message is not easily translatable, which is what the %s is for.  It would be more straightforward and translatable to use something like:\n\n  if e.code \u003d\u003d 400:\n      msg \u003d _(\u0027Unable to create new image: Invalid disk format %s for image.\u0027) % \n                  data[\u0027disk_format\u0027]\n  else:\n      msg \u003d _(\u0027Unable to create new image\u0027)","commit_id":"4615e8898b57522329bb1805e3c18a2fefcf44db"},{"author":{"_account_id":11880,"name":"Gloria Gu","email":"gloriafanggu@gmail.com","username":"gugl"},"change_message_id":"0beba65ab25ca91417f120ae560efa3d183f902e","unresolved":false,"context_lines":[{"line_number":186,"context_line":"            msg \u003d \"\""},{"line_number":187,"context_line":"            if e.code \u003d\u003d 400:"},{"line_number":188,"context_line":"                msg \u003d _(\u0027Unable to create new image: Invalid disk format %s\u0027"},{"line_number":189,"context_line":"                        \u0027for image.\u0027) % data[\u0027disk_format\u0027]"},{"line_number":190,"context_line":"            else:"},{"line_number":191,"context_line":"                msg \u003d _(\u0027Unable to create new image\u0027)"},{"line_number":192,"context_line":"            redirect \u003d reverse(self.failure_url)"}],"source_content_type":"text/x-python","patch_set":6,"id":"5a890539_50748567","line":189,"updated":"2014-11-14 01:37:51.000000000","message":"400 means bad request , I am looking at the the glance code for the create\nopt/stack/glance/api/v2/images.py, you can see there can be a couple of issues which cause the API to throw bad request. \n\n def create(self, req, image, extra_properties, tags):\n        image_factory \u003d self.gateway.get_image_factory(req.context)\n        image_repo \u003d self.gateway.get_repo(req.context)\n        try:\n            image \u003d image_factory.new_image(extra_properties\u003dextra_properties,\n                                            tags\u003dtags, **image)\n            image_repo.add(image)\n        except exception.DuplicateLocation as dup:\n            raise webob.exc.HTTPBadRequest(explanation\u003ddup.msg)\n        except exception.Forbidden as e:\n            raise webob.exc.HTTPForbidden(explanation\u003de.msg)\n        except exception.InvalidParameterValue as e:\n            raise webob.exc.HTTPBadRequest(explanation\u003de.msg)\n        except exception.LimitExceeded as e:\n            LOG.info(utils.exception_to_str(e))\n            raise webob.exc.HTTPRequestEntityTooLarge(\n                explanation\u003de.msg, request\u003dreq, content_type\u003d\u0027text/plain\u0027)\n        except exception.Duplicate as dupex:\n            raise webob.exc.HTTPConflict(explanation\u003ddupex.msg)\n\n        return image","commit_id":"af243be10579bb23662377feb62f3d501245cf96"},{"author":{"_account_id":11880,"name":"Gloria Gu","email":"gloriafanggu@gmail.com","username":"gugl"},"change_message_id":"927b8782b4bc2d048d6eaa203c394b541b92d443","unresolved":false,"context_lines":[{"line_number":186,"context_line":"            msg \u003d \"\""},{"line_number":187,"context_line":"            if e.code \u003d\u003d 400:"},{"line_number":188,"context_line":"                msg \u003d _(\u0027Unable to create new image: Invalid disk format %s\u0027"},{"line_number":189,"context_line":"                        \u0027for image.\u0027) % data[\u0027disk_format\u0027]"},{"line_number":190,"context_line":"            else:"},{"line_number":191,"context_line":"                msg \u003d _(\u0027Unable to create new image\u0027)"},{"line_number":192,"context_line":"            redirect \u003d reverse(self.failure_url)"}],"source_content_type":"text/x-python","patch_set":6,"id":"5a890539_0d752d63","line":189,"in_reply_to":"5a890539_22111852","updated":"2014-11-18 00:51:45.000000000","message":"The following code is in glance v1: \n\nif \u0027disk_format\u0027 in values:\n        if disk_format not in CONF.image_format.disk_formats:\n            msg \u003d _(\"Invalid disk format \u0027%s\u0027 for image.\") % disk_format\n            raise HTTPBadRequest(explanation\u003dmsg, request\u003dreq)\n\n    if \u0027container_format\u0027 in values:\n        if container_format not in CONF.image_format.container_formats:\n            msg \u003d _(\"Invalid container format \u0027%s\u0027 \"\n                    \"for image.\") % container_format\n            raise HTTPBadRequest(explanation\u003dmsg, request\u003dreq)\n\n    if name and len(name) \u003e 255:\n        msg \u003d _(\u0027Image name too long: %d\u0027) % len(name)\n        raise HTTPBadRequest(explanation\u003dmsg, request\u003dreq)\n\nAs you can see there are quite bit of bad requests threw.based on different parameters..parsing the message to look for \u0027disk format\u0027 which is localized  is error prone. Plus, v2 way seems to be different, but I didn\u0027t dig more.","commit_id":"af243be10579bb23662377feb62f3d501245cf96"},{"author":{"_account_id":11880,"name":"Gloria Gu","email":"gloriafanggu@gmail.com","username":"gugl"},"change_message_id":"d29ecd89fe815dc2c35e679ea42d8c766e693b76","unresolved":false,"context_lines":[{"line_number":186,"context_line":"            msg \u003d \"\""},{"line_number":187,"context_line":"            if e.code \u003d\u003d 400:"},{"line_number":188,"context_line":"                msg \u003d _(\u0027Unable to create new image: Invalid disk format %s\u0027"},{"line_number":189,"context_line":"                        \u0027for image.\u0027) % data[\u0027disk_format\u0027]"},{"line_number":190,"context_line":"            else:"},{"line_number":191,"context_line":"                msg \u003d _(\u0027Unable to create new image\u0027)"},{"line_number":192,"context_line":"            redirect \u003d reverse(self.failure_url)"}],"source_content_type":"text/x-python","patch_set":6,"id":"5a890539_feaa846f","line":189,"in_reply_to":"5a890539_2e0b157e","updated":"2014-11-14 19:55:25.000000000","message":"those 2 exceptions will raise  webob.exc.HTTPBadRequest which has code 409 from API. \nexcept exception.DuplicateLocation as dup:\n            raise webob.exc.HTTPBadRequest(explanation\u003ddup.msg)\nexcept exception.InvalidParameterValue as e:\n            raise webob.exc.HTTPBadRequest(explanation\u003de.msg)","commit_id":"af243be10579bb23662377feb62f3d501245cf96"},{"author":{"_account_id":11599,"name":"Nikunj Aggarwal","email":"nikunj.aggarwal@hp.com","username":"nikunj2512"},"change_message_id":"2faadf39afdc0eeea78087cea18630facb379417","unresolved":false,"context_lines":[{"line_number":186,"context_line":"            msg \u003d \"\""},{"line_number":187,"context_line":"            if e.code \u003d\u003d 400:"},{"line_number":188,"context_line":"                msg \u003d _(\u0027Unable to create new image: Invalid disk format %s\u0027"},{"line_number":189,"context_line":"                        \u0027for image.\u0027) % data[\u0027disk_format\u0027]"},{"line_number":190,"context_line":"            else:"},{"line_number":191,"context_line":"                msg \u003d _(\u0027Unable to create new image\u0027)"},{"line_number":192,"context_line":"            redirect \u003d reverse(self.failure_url)"}],"source_content_type":"text/x-python","patch_set":6,"id":"5a890539_2e0b157e","line":189,"in_reply_to":"5a890539_50748567","updated":"2014-11-14 05:00:48.000000000","message":"400 means bad request in Horizon context but when any exception happens in glance, it also gives an error code and for each exception the error code is different.","commit_id":"af243be10579bb23662377feb62f3d501245cf96"},{"author":{"_account_id":11880,"name":"Gloria Gu","email":"gloriafanggu@gmail.com","username":"gugl"},"change_message_id":"5f21f3f9025592e240853282db247faa3bc38c86","unresolved":false,"context_lines":[{"line_number":186,"context_line":"            msg \u003d \"\""},{"line_number":187,"context_line":"            if e.code \u003d\u003d 400:"},{"line_number":188,"context_line":"                msg \u003d _(\u0027Unable to create new image: Invalid disk format %s\u0027"},{"line_number":189,"context_line":"                        \u0027for image.\u0027) % data[\u0027disk_format\u0027]"},{"line_number":190,"context_line":"            else:"},{"line_number":191,"context_line":"                msg \u003d _(\u0027Unable to create new image\u0027)"},{"line_number":192,"context_line":"            redirect \u003d reverse(self.failure_url)"}],"source_content_type":"text/x-python","patch_set":6,"id":"5a890539_22111852","line":189,"in_reply_to":"5a890539_d86b17ef","updated":"2014-11-18 00:33:15.000000000","message":"HI Nikunj, \n\nSorry , typo,  code should be 400.  409 is conflict. \nThis is a ugly one due to the error handling issue between backend and frontend,  parsing the message is tricky since the message could be localized. For me including the exception in the message is the best way to show the root cause of the issue instead just say \u0027Unable to create new image\u0027, but the problem is it is not recommended in Horizon.  Julie P mentioned in the bug, there is a blueprint for improving the error message handling. In order to deal with the bug at this point, you might want to dig a little more to glance code to see if you could find a cleaner way to parse the message,","commit_id":"af243be10579bb23662377feb62f3d501245cf96"},{"author":{"_account_id":11599,"name":"Nikunj Aggarwal","email":"nikunj.aggarwal@hp.com","username":"nikunj2512"},"change_message_id":"a7df2d9ffe4624246bfc363c09d89021cccde31e","unresolved":false,"context_lines":[{"line_number":186,"context_line":"            msg \u003d \"\""},{"line_number":187,"context_line":"            if e.code \u003d\u003d 400:"},{"line_number":188,"context_line":"                msg \u003d _(\u0027Unable to create new image: Invalid disk format %s\u0027"},{"line_number":189,"context_line":"                        \u0027for image.\u0027) % data[\u0027disk_format\u0027]"},{"line_number":190,"context_line":"            else:"},{"line_number":191,"context_line":"                msg \u003d _(\u0027Unable to create new image\u0027)"},{"line_number":192,"context_line":"            redirect \u003d reverse(self.failure_url)"}],"source_content_type":"text/x-python","patch_set":6,"id":"5a890539_d86b17ef","line":189,"in_reply_to":"5a890539_feaa846f","updated":"2014-11-15 05:56:01.000000000","message":"Ok. But this code is meant to handle the \"Invalid disk format\" errors. So, with checking the error code, will i parse the message also??\n\nLike i can check if message contains the disk_format and if yes than with error code \u003d\u003d 400, i can display the error message.\n\nWill that be ok??","commit_id":"af243be10579bb23662377feb62f3d501245cf96"},{"author":{"_account_id":12826,"name":"Rob Cresswell","display_name":"robcresswell","email":"robert.cresswell@outlook.com","username":"rob-cresswell"},"change_message_id":"836536e8ebbe556f45a5c20f681498bfb571deae","unresolved":false,"context_lines":[{"line_number":183,"context_line":"                             data[\u0027name\u0027])"},{"line_number":184,"context_line":"            return image"},{"line_number":185,"context_line":"        except Exception as e:"},{"line_number":186,"context_line":"            msg \u003d \"\""},{"line_number":187,"context_line":"            if e.code \u003d\u003d 400:"},{"line_number":188,"context_line":"                if \"Invalid disk format\" in e.details:"},{"line_number":189,"context_line":"                    msg \u003d _(\u0027Unable to create new image: Invalid disk format\u0027"}],"source_content_type":"text/x-python","patch_set":12,"id":"5a890539_b090d64f","line":186,"updated":"2014-11-18 17:31:23.000000000","message":"nit: This line can be removed, as it is always defined below on \u0027else\u0027","commit_id":"0040a89c93fa572160acadb11945669cd09223b8"},{"author":{"_account_id":6637,"name":"Sam Betts","email":"sam@code-smash.net","username":"sambetts"},"change_message_id":"243c70ea1c7e994d1e44a986372726ec07ca4172","unresolved":false,"context_lines":[{"line_number":184,"context_line":"            return image"},{"line_number":185,"context_line":"        except Exception as e:"},{"line_number":186,"context_line":"            msg \u003d \"\""},{"line_number":187,"context_line":"            if e.code \u003d\u003d 400:"},{"line_number":188,"context_line":"                if \"Invalid disk format\" in e.details:"},{"line_number":189,"context_line":"                    msg \u003d _(\u0027Unable to create new image: Invalid disk format\u0027"},{"line_number":190,"context_line":"                            \u0027%s for image.\u0027) % data[\u0027disk_format\u0027]"}],"source_content_type":"text/x-python","patch_set":12,"id":"5a890539_5d4a50ad","line":187,"updated":"2014-11-19 09:59:02.000000000","message":"By catching Exception it opens this catch block up to many different types of exception, not all of them have a code attribute so this line will throw an AttributeError if it doesn\u0027t have that.","commit_id":"0040a89c93fa572160acadb11945669cd09223b8"},{"author":{"_account_id":12826,"name":"Rob Cresswell","display_name":"robcresswell","email":"robert.cresswell@outlook.com","username":"rob-cresswell"},"change_message_id":"0600eb549d5788fcccc696be3c1703e3b910b913","unresolved":false,"context_lines":[{"line_number":187,"context_line":"            if e.code \u003d\u003d 400:"},{"line_number":188,"context_line":"                if \"Invalid disk format\" in e.details:"},{"line_number":189,"context_line":"                    msg \u003d _(\u0027Unable to create new image: Invalid disk format\u0027"},{"line_number":190,"context_line":"                            \u0027%s for image.\u0027) % data[\u0027disk_format\u0027]"},{"line_number":191,"context_line":"                elif \"Image name too long\" in e.details:"},{"line_number":192,"context_line":"                    msg \u003d _(\u0027Unable to create new image: Image name too long: \u0027"},{"line_number":193,"context_line":"                            \u0027%d\u0027) % len(data[\u0027name\u0027])"}],"source_content_type":"text/x-python","patch_set":12,"id":"5a890539_bdfdf470","line":190,"updated":"2014-11-19 09:53:08.000000000","message":"Need a space between format and %s","commit_id":"0040a89c93fa572160acadb11945669cd09223b8"},{"author":{"_account_id":12355,"name":"Vlad Okhrimenko","email":"vokhrimenko@mirantis.com","username":"vokhrimenko"},"change_message_id":"24e350c509d197049f7c999ec36580a3c2b02607","unresolved":false,"context_lines":[{"line_number":196,"context_line":"                msg \u003d _(\u0027Unable to create new image\u0027)"},{"line_number":197,"context_line":""},{"line_number":198,"context_line":"            redirect \u003d reverse(self.failure_url)"},{"line_number":199,"context_line":"            exceptions.handle(request, msg, redirect\u003dredirect)"},{"line_number":200,"context_line":""},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"class UpdateImageForm(forms.SelfHandlingForm):"}],"source_content_type":"text/x-python","patch_set":13,"id":"5a890539_538fa1cc","line":199,"updated":"2014-11-19 10:59:57.000000000","message":"I think we should be add something like this https://github.com/openstack/horizon/blob/2014.2.rc1/openstack_dashboard/dashboards/admin/images/forms.py#L66  --- in order to does not close form.","commit_id":"ca9b37696fb4434b9f65a08a6a943689dc5eded9"},{"author":{"_account_id":13086,"name":"Yash Bathia","email":"ybathia@yahoo-inc.com","username":"ybathia"},"change_message_id":"8681ac46b6f6ec3afc9fde0f00c3600b021a1760","unresolved":false,"context_lines":[{"line_number":181,"context_line":"                             data[\u0027name\u0027])"},{"line_number":182,"context_line":"            return image"},{"line_number":183,"context_line":"        except Exception as e:"},{"line_number":184,"context_line":"            if hasattr(e, \u0027code\u0027) and e.code \u003d\u003d 400:"},{"line_number":185,"context_line":"                if \"Invalid disk format\" in e.details:"},{"line_number":186,"context_line":"                    msg \u003d _(\u0027Unable to create new image: Invalid disk format \u0027"},{"line_number":187,"context_line":"                            \u0027%s for image.\u0027) % data[\u0027disk_format\u0027]"}],"source_content_type":"text/x-python","patch_set":14,"id":"3a961159_e519f1d1","line":184,"updated":"2014-12-23 00:22:05.000000000","message":"You can set msg \u003d _(\u0027Unable to create new image\u0027) before the if clause and remove the two else statements to avoid code repetition/redundancy.","commit_id":"91095b46c2fdf1e38fe53819804066d1de1eca4c"},{"author":{"_account_id":6610,"name":"Zhenguo Niu","email":"Niu.ZGlinux@gmail.com","username":"niu-zglinux"},"change_message_id":"c56a977afd155be46e356e5631e25a9b7845a398","unresolved":false,"context_lines":[{"line_number":181,"context_line":"                             data[\u0027name\u0027])"},{"line_number":182,"context_line":"            return image"},{"line_number":183,"context_line":"        except Exception as e:"},{"line_number":184,"context_line":"            if hasattr(e, \u0027code\u0027) and e.code \u003d\u003d 400:"},{"line_number":185,"context_line":"                if \"Invalid disk format\" in e.details:"},{"line_number":186,"context_line":"                    msg \u003d _(\u0027Unable to create new image: Invalid disk format \u0027"},{"line_number":187,"context_line":"                            \u0027%s for image.\u0027) % data[\u0027disk_format\u0027]"}],"source_content_type":"text/x-python","patch_set":14,"id":"3a961159_0628c431","line":184,"in_reply_to":"3a961159_e519f1d1","updated":"2014-12-23 03:02:44.000000000","message":"agree with setting \u0027Unable to create new image\u0027 as default message to avoid repetition.","commit_id":"91095b46c2fdf1e38fe53819804066d1de1eca4c"},{"author":{"_account_id":6610,"name":"Zhenguo Niu","email":"Niu.ZGlinux@gmail.com","username":"niu-zglinux"},"change_message_id":"c56a977afd155be46e356e5631e25a9b7845a398","unresolved":false,"context_lines":[{"line_number":185,"context_line":"                if \"Invalid disk format\" in e.details:"},{"line_number":186,"context_line":"                    msg \u003d _(\u0027Unable to create new image: Invalid disk format \u0027"},{"line_number":187,"context_line":"                            \u0027%s for image.\u0027) % data[\u0027disk_format\u0027]"},{"line_number":188,"context_line":"                elif \"Image name too long\" in e.details:"},{"line_number":189,"context_line":"                    msg \u003d _(\u0027Unable to create new image: Image name too long: \u0027"},{"line_number":190,"context_line":"                            \u0027%d\u0027) % len(data[\u0027name\u0027])"},{"line_number":191,"context_line":"                else:"}],"source_content_type":"text/x-python","patch_set":14,"id":"3a961159_66efc8e9","line":188,"updated":"2014-12-23 03:02:44.000000000","message":"there is already a restriction max_length\u003d255 for image name field at L40.\nIt\u0027s no need to check this again.","commit_id":"91095b46c2fdf1e38fe53819804066d1de1eca4c"},{"author":{"_account_id":12825,"name":"Szymon Wróblewski","email":"szymon.wroblewski@ovhcloud.com","username":"bluex"},"change_message_id":"9eb9b2697663a37fc27fa101982f66034c47f7cb","unresolved":false,"context_lines":[{"line_number":182,"context_line":"            return image"},{"line_number":183,"context_line":"        except Exception as e:"},{"line_number":184,"context_line":"            msg \u003d _(\u0027Unable to create new image\u0027)"},{"line_number":185,"context_line":"            if hasattr(e, \u0027code\u0027) and e.code \u003d\u003d 400:"},{"line_number":186,"context_line":"                if \"Invalid disk format\" in e.details:"},{"line_number":187,"context_line":"                    msg \u003d _(\u0027Unable to create new image: Invalid disk format \u0027"},{"line_number":188,"context_line":"                            \u0027%s for image.\u0027) % data[\u0027disk_format\u0027]"}],"source_content_type":"text/x-python","patch_set":16,"id":"3a961159_e3639fae","line":185,"updated":"2014-12-23 14:17:48.000000000","message":"Can be changed to\n\n getattr(e, \u0027code\u0027, None) \u003d\u003d 400","commit_id":"dc294f18cc59bfb4aa568b5fce07e98ab9139703"},{"author":{"_account_id":12355,"name":"Vlad Okhrimenko","email":"vokhrimenko@mirantis.com","username":"vokhrimenko"},"change_message_id":"cac3a8d87608a3a5271d2ed20be25b1e83f78cd7","unresolved":false,"context_lines":[{"line_number":182,"context_line":"            return image"},{"line_number":183,"context_line":"        except Exception as e:"},{"line_number":184,"context_line":"            msg \u003d _(\u0027Unable to create new image\u0027)"},{"line_number":185,"context_line":"            if hasattr(e, \u0027code\u0027) and e.code \u003d\u003d 400:"},{"line_number":186,"context_line":"                if \"Invalid disk format\" in e.details:"},{"line_number":187,"context_line":"                    msg \u003d _(\u0027Unable to create new image: Invalid disk format \u0027"},{"line_number":188,"context_line":"                            \u0027%s for image.\u0027) % data[\u0027disk_format\u0027]"}],"source_content_type":"text/x-python","patch_set":16,"id":"3a961159_d2e47210","line":185,"in_reply_to":"3a961159_c1913b48","updated":"2014-12-26 12:14:00.000000000","message":"Hi Nikunj! What do you think about(BadRequest have 400 error):\n\nfrom glanceclient.exc import exceptions as glance_exc\n\n.................\n\nexcept glance_exc.BadRequest:\n    ..........\nexcept Exception as e:\n    ........\n\nsomething like this:\nhttps://review.openstack.org/#/c/116226/15/openstack_dashboard/dashboards/project/access_and_security/floating_ips/views.py","commit_id":"dc294f18cc59bfb4aa568b5fce07e98ab9139703"},{"author":{"_account_id":11599,"name":"Nikunj Aggarwal","email":"nikunj.aggarwal@hp.com","username":"nikunj2512"},"change_message_id":"42f7b7bea70ac55af075e7ad41416aa46e52934a","unresolved":false,"context_lines":[{"line_number":182,"context_line":"            return image"},{"line_number":183,"context_line":"        except Exception as e:"},{"line_number":184,"context_line":"            msg \u003d _(\u0027Unable to create new image\u0027)"},{"line_number":185,"context_line":"            if hasattr(e, \u0027code\u0027) and e.code \u003d\u003d 400:"},{"line_number":186,"context_line":"                if \"Invalid disk format\" in e.details:"},{"line_number":187,"context_line":"                    msg \u003d _(\u0027Unable to create new image: Invalid disk format \u0027"},{"line_number":188,"context_line":"                            \u0027%s for image.\u0027) % data[\u0027disk_format\u0027]"}],"source_content_type":"text/x-python","patch_set":16,"id":"3a961159_c1913b48","line":185,"in_reply_to":"3a961159_e3639fae","updated":"2014-12-23 14:25:01.000000000","message":"i think above condition is more clearer.","commit_id":"dc294f18cc59bfb4aa568b5fce07e98ab9139703"},{"author":{"_account_id":12825,"name":"Szymon Wróblewski","email":"szymon.wroblewski@ovhcloud.com","username":"bluex"},"change_message_id":"9eb9b2697663a37fc27fa101982f66034c47f7cb","unresolved":false,"context_lines":[{"line_number":183,"context_line":"        except Exception as e:"},{"line_number":184,"context_line":"            msg \u003d _(\u0027Unable to create new image\u0027)"},{"line_number":185,"context_line":"            if hasattr(e, \u0027code\u0027) and e.code \u003d\u003d 400:"},{"line_number":186,"context_line":"                if \"Invalid disk format\" in e.details:"},{"line_number":187,"context_line":"                    msg \u003d _(\u0027Unable to create new image: Invalid disk format \u0027"},{"line_number":188,"context_line":"                            \u0027%s for image.\u0027) % data[\u0027disk_format\u0027]"},{"line_number":189,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"3a961159_83abbb73","line":186,"updated":"2014-12-23 14:17:48.000000000","message":"Can be merged with previous condition.\nWhy do you assume details attribute will be availale? Should be changed to\n\n \u0027Invalid disk format\u0027 in getattr(e, \u0027details\u0027, \u0027\u0027)","commit_id":"dc294f18cc59bfb4aa568b5fce07e98ab9139703"},{"author":{"_account_id":11599,"name":"Nikunj Aggarwal","email":"nikunj.aggarwal@hp.com","username":"nikunj2512"},"change_message_id":"42f7b7bea70ac55af075e7ad41416aa46e52934a","unresolved":false,"context_lines":[{"line_number":183,"context_line":"        except Exception as e:"},{"line_number":184,"context_line":"            msg \u003d _(\u0027Unable to create new image\u0027)"},{"line_number":185,"context_line":"            if hasattr(e, \u0027code\u0027) and e.code \u003d\u003d 400:"},{"line_number":186,"context_line":"                if \"Invalid disk format\" in e.details:"},{"line_number":187,"context_line":"                    msg \u003d _(\u0027Unable to create new image: Invalid disk format \u0027"},{"line_number":188,"context_line":"                            \u0027%s for image.\u0027) % data[\u0027disk_format\u0027]"},{"line_number":189,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"3a961159_a1a6efa8","line":186,"in_reply_to":"3a961159_83abbb73","updated":"2014-12-23 14:25:01.000000000","message":"Because if glance always sends the details attr with 400 exception. if exception code \u003d\u003d 400 and it is 100% sure that details will be there. So, i don\u0027t think there is a need to change this.","commit_id":"dc294f18cc59bfb4aa568b5fce07e98ab9139703"},{"author":{"_account_id":12355,"name":"Vlad Okhrimenko","email":"vokhrimenko@mirantis.com","username":"vokhrimenko"},"change_message_id":"003290361d538acb1c727b6a2a571707c97913b7","unresolved":false,"context_lines":[{"line_number":182,"context_line":"            return image"},{"line_number":183,"context_line":"        except Exception as e:"},{"line_number":184,"context_line":"            msg \u003d _(\u0027Unable to create new image\u0027)"},{"line_number":185,"context_line":"            if hasattr(e, \u0027code\u0027) and e.code \u003d\u003d 400:"},{"line_number":186,"context_line":"                if \"Invalid disk format\" in e.details:"},{"line_number":187,"context_line":"                    msg \u003d _(\u0027Unable to create new image: Invalid disk format \u0027"},{"line_number":188,"context_line":"                            \u0027%s for image.\u0027) % data[\u0027disk_format\u0027]"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a961159_18ac9134","line":185,"updated":"2015-01-08 12:49:23.000000000","message":"Hi! I added comment in 16 patch. You didn\u0027t answer me...","commit_id":"c0e7e9c729ec27133acca440c091406823feb5c2"},{"author":{"_account_id":11599,"name":"Nikunj Aggarwal","email":"nikunj.aggarwal@hp.com","username":"nikunj2512"},"change_message_id":"52e74b6108e479179bd8879d03d4e1302984d42a","unresolved":false,"context_lines":[{"line_number":182,"context_line":"            return image"},{"line_number":183,"context_line":"        except Exception as e:"},{"line_number":184,"context_line":"            msg \u003d _(\u0027Unable to create new image\u0027)"},{"line_number":185,"context_line":"            if hasattr(e, \u0027code\u0027) and e.code \u003d\u003d 400:"},{"line_number":186,"context_line":"                if \"Invalid disk format\" in e.details:"},{"line_number":187,"context_line":"                    msg \u003d _(\u0027Unable to create new image: Invalid disk format \u0027"},{"line_number":188,"context_line":"                            \u0027%s for image.\u0027) % data[\u0027disk_format\u0027]"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a961159_7bd10f56","line":185,"updated":"2015-01-08 13:08:47.000000000","message":"This should not be done but due to glance current limitations i had taken this root. As you suggested we can have this approach for now and later when we have better exception messages from glance we can update the code here. So, meanwhile users can see the reason for those special cases mentioned in the patch.","commit_id":"c0e7e9c729ec27133acca440c091406823feb5c2"},{"author":{"_account_id":12825,"name":"Szymon Wróblewski","email":"szymon.wroblewski@ovhcloud.com","username":"bluex"},"change_message_id":"285feddd51ec42a6344dd6518c08ff963b72fdab","unresolved":false,"context_lines":[{"line_number":182,"context_line":"            return image"},{"line_number":183,"context_line":"        except Exception as e:"},{"line_number":184,"context_line":"            msg \u003d _(\u0027Unable to create new image\u0027)"},{"line_number":185,"context_line":"            if hasattr(e, \u0027code\u0027) and e.code \u003d\u003d 400:"},{"line_number":186,"context_line":"                if \"Invalid disk format\" in e.details:"},{"line_number":187,"context_line":"                    msg \u003d _(\u0027Unable to create new image: Invalid disk format \u0027"},{"line_number":188,"context_line":"                            \u0027%s for image.\u0027) % data[\u0027disk_format\u0027]"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a961159_9be15bd2","line":185,"in_reply_to":"3a961159_7bd10f56","updated":"2015-01-08 13:23:15.000000000","message":"Ok, but then you should add \n\n # todo(\u003cyour_id\u003e): ... \n\ncomment, so when the moment in future comes, you will change this part.","commit_id":"c0e7e9c729ec27133acca440c091406823feb5c2"},{"author":{"_account_id":12355,"name":"Vlad Okhrimenko","email":"vokhrimenko@mirantis.com","username":"vokhrimenko"},"change_message_id":"1fb06021bfdf4896e8a9392d6a8283ff0de72764","unresolved":false,"context_lines":[{"line_number":182,"context_line":"            return image"},{"line_number":183,"context_line":"        except Exception as e:"},{"line_number":184,"context_line":"            msg \u003d _(\u0027Unable to create new image\u0027)"},{"line_number":185,"context_line":"            if hasattr(e, \u0027code\u0027) and e.code \u003d\u003d 400:"},{"line_number":186,"context_line":"                if \"Invalid disk format\" in e.details:"},{"line_number":187,"context_line":"                    msg \u003d _(\u0027Unable to create new image: Invalid disk format \u0027"},{"line_number":188,"context_line":"                            \u0027%s for image.\u0027) % data[\u0027disk_format\u0027]"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a961159_db5843fb","line":185,"in_reply_to":"3a961159_7bd10f56","updated":"2015-01-08 13:12:28.000000000","message":"Thanks, Nikunj !\nBadRequest is deprecated\nhttps://github.com/openstack/python-glanceclient/blob/master/glanceclient/exc.py#L65","commit_id":"c0e7e9c729ec27133acca440c091406823feb5c2"},{"author":{"_account_id":13161,"name":"Kamil Rykowski","email":"kamil.rykowski@gmail.com","username":"krykowski"},"change_message_id":"cb9b9a60eea075f5aa7c2d4abca4ac976f6ca613","unresolved":false,"context_lines":[{"line_number":1,"context_line":" \t"},{"line_number":2,"context_line":"# Copyright 2012 United States Government as represented by the"},{"line_number":3,"context_line":"# Administrator of the National Aeronautics and Space Administration."},{"line_number":4,"context_line":"# All Rights Reserved."}],"source_content_type":"text/x-python","patch_set":19,"id":"3a961159_819c8cc1","line":1,"updated":"2015-01-08 14:23:41.000000000","message":"redundant empty line at the top of the file","commit_id":"d50e9cbd13b2adfb2aa071b416530ca6bb2a87c2"},{"author":{"_account_id":10442,"name":"Masco Kaliyamoorthy","email":"mkaliyam@redhat.com","username":"masco"},"change_message_id":"2ef96361fa9d46d219496cf84ca0789eb26bbdc0","unresolved":false,"context_lines":[{"line_number":186,"context_line":"            if hasattr(e, \u0027code\u0027) and e.code \u003d\u003d 400:"},{"line_number":187,"context_line":"                if \"Invalid disk format\" in e.details:"},{"line_number":188,"context_line":"                    msg \u003d _(\u0027Unable to create new image: Invalid disk format \u0027"},{"line_number":189,"context_line":"                            \u0027%s for image.\u0027) % data[\u0027disk_format\u0027]"},{"line_number":190,"context_line":""},{"line_number":191,"context_line":"            exceptions.handle(request, msg)"},{"line_number":192,"context_line":""}],"source_content_type":"text/x-python","patch_set":20,"id":"3a961159_80254d5c","line":189,"updated":"2015-01-19 07:26:10.000000000","message":"i guess, if we add the image name (data[\u0027name\u0027]) also in the error message, it will make more sense.","commit_id":"2e3294ec30f3d6b07e1ce9b6e4f2138fc98a26ef"},{"author":{"_account_id":11599,"name":"Nikunj Aggarwal","email":"nikunj.aggarwal@hp.com","username":"nikunj2512"},"change_message_id":"d83dfa847c68d468d6817cd5e06c437dbdd5f9d3","unresolved":false,"context_lines":[{"line_number":186,"context_line":"            if hasattr(e, \u0027code\u0027) and e.code \u003d\u003d 400:"},{"line_number":187,"context_line":"                if \"Invalid disk format\" in e.details:"},{"line_number":188,"context_line":"                    msg \u003d _(\u0027Unable to create new image: Invalid disk format \u0027"},{"line_number":189,"context_line":"                            \u0027%s for image.\u0027) % data[\u0027disk_format\u0027]"},{"line_number":190,"context_line":""},{"line_number":191,"context_line":"            exceptions.handle(request, msg)"},{"line_number":192,"context_line":""}],"source_content_type":"text/x-python","patch_set":20,"id":"1a930d6b_7b5c3dee","line":189,"in_reply_to":"3a961159_80254d5c","updated":"2015-01-22 18:25:19.000000000","message":"i don\u0027t think it is necessary because user can only upload one image at a time and when this error comes, user will know that this error belongs to which image.","commit_id":"2e3294ec30f3d6b07e1ce9b6e4f2138fc98a26ef"}]}
