)]}'
{"nova/api/openstack/compute/contrib/quotas.py":[{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"b1e8a4fdda8878fa1d039215816718d68e9ec9b2","unresolved":false,"context_lines":[{"line_number":97,"context_line":"        self._validate_quota_value(quota_set)"},{"line_number":98,"context_line":"        for key in quota_set.keys():"},{"line_number":99,"context_line":"            if key in QUOTAS:"},{"line_number":100,"context_line":"                value \u003d int(quota_set[key])"},{"line_number":101,"context_line":"                self._validate_quota_limit(value)"},{"line_number":102,"context_line":"                try:"},{"line_number":103,"context_line":"                    db.quota_update(context, project_id, key, value)"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2FPxM%3D","line":100,"updated":"2013-01-31 16:08:23.000000000","message":"The better way to implement this is to use exception handling around this line, i.e.:\n\n    try:\n        value \u003d int(body[\u0027quota_set\u0027][key])\n    except ValueError:\n        msg \u003d _(\"Quota for %s should be an integer.\") % key\n        raise webob.exc.HTTPBadRequest(explanation\u003dmsg)","commit_id":"fa9931bf471c54c486a5212dc8681adb8d988c0b"},{"author":{"_account_id":6759,"name":"hzzhoushaoyu","email":"hzzhoushaoyu@corp.netease.com","username":"hzzhoushaoyu"},"change_message_id":"96d9e4f142ff6a54bc56f3d9af77a3eca75519f9","unresolved":false,"context_lines":[{"line_number":97,"context_line":"        self._validate_quota_value(quota_set)"},{"line_number":98,"context_line":"        for key in quota_set.keys():"},{"line_number":99,"context_line":"            if key in QUOTAS:"},{"line_number":100,"context_line":"                value \u003d int(quota_set[key])"},{"line_number":101,"context_line":"                self._validate_quota_limit(value)"},{"line_number":102,"context_line":"                try:"},{"line_number":103,"context_line":"                    db.quota_update(context, project_id, key, value)"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2FOxs%3D","line":100,"in_reply_to":"AAAAM3%2F%2FPxM%3D","updated":"2013-02-01 01:40:41.000000000","message":"I did in this way before.But when update quota set with multiple quotas and one of them is not valid, some may be updated and others not. And responding 400 means not update successfully.","commit_id":"fa9931bf471c54c486a5212dc8681adb8d988c0b"},{"author":{"_account_id":2750,"name":"Sean Dague","email":"sean@dague.net","username":"sdague"},"change_message_id":"5f0059634a393b45e220fe6d3c265c9b0febd8e4","unresolved":false,"context_lines":[{"line_number":90,"context_line":"        project_id \u003d id"},{"line_number":91,"context_line":"        for key in body[\u0027quota_set\u0027].keys():"},{"line_number":92,"context_line":"            if key in QUOTAS:"},{"line_number":93,"context_line":"                try:"},{"line_number":94,"context_line":"                    value \u003d int(body[\u0027quota_set\u0027][key])"},{"line_number":95,"context_line":"                except (ValueError, TypeError):"},{"line_number":96,"context_line":"                    LOG.warn(_(\"Quota for %s should be integer.\") % key)"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAM3%2F%2FDHA%3D","line":93,"updated":"2013-02-09 00:32:40.000000000","message":"we actually have an is_int_like function in nova/utils.py, I think it would be better to use that instead of the try here.\n\nif utils.is_int_like(body[\u0027quota_set\u0027][key]):\n   value \u003d int(body[\u0027quota_set\u0027][key])","commit_id":"43bd52ba9f59086f2aaf7c5cc3a81ca40721f887"},{"author":{"_account_id":2271,"name":"Michael Still","email":"mikal@stillhq.com","username":"mikalstill"},"change_message_id":"9573d839f810817893e62caae9b1eef8fabd31f7","unresolved":false,"context_lines":[{"line_number":90,"context_line":"        project_id \u003d id"},{"line_number":91,"context_line":"        for key in body[\u0027quota_set\u0027].keys():"},{"line_number":92,"context_line":"            if key in QUOTAS:"},{"line_number":93,"context_line":"                try:"},{"line_number":94,"context_line":"                    value \u003d int(body[\u0027quota_set\u0027][key])"},{"line_number":95,"context_line":"                except (ValueError, TypeError):"},{"line_number":96,"context_line":"                    LOG.warn(_(\"Quota for %s should be integer.\") % key)"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAM3%2F%2B9bc%3D","line":93,"in_reply_to":"AAAAM3%2F%2FA8c%3D","updated":"2013-02-13 06:23:22.000000000","message":"I think its a question of style really. Not worth blocking the review over.","commit_id":"43bd52ba9f59086f2aaf7c5cc3a81ca40721f887"},{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"01c7a9bd855068c0729a23f80288ca0dd57c47bb","unresolved":false,"context_lines":[{"line_number":90,"context_line":"        project_id \u003d id"},{"line_number":91,"context_line":"        for key in body[\u0027quota_set\u0027].keys():"},{"line_number":92,"context_line":"            if key in QUOTAS:"},{"line_number":93,"context_line":"                try:"},{"line_number":94,"context_line":"                    value \u003d int(body[\u0027quota_set\u0027][key])"},{"line_number":95,"context_line":"                except (ValueError, TypeError):"},{"line_number":96,"context_line":"                    LOG.warn(_(\"Quota for %s should be integer.\") % key)"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAM3%2F%2FA8c%3D","line":93,"in_reply_to":"AAAAM3%2F%2FDHA%3D","updated":"2013-02-11 16:44:57.000000000","message":"I see that as less efficient, to be honest.  I prefer the try/assignment/except/warn scheme that he has here.","commit_id":"43bd52ba9f59086f2aaf7c5cc3a81ca40721f887"}]}
