)]}'
{"swift/cli/info.py":[{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"d00292a392f5767c228bbfe3da590684c0f2c690","unresolved":false,"context_lines":[{"line_number":112,"context_line":"        if db_type \u003d\u003d \u0027container\u0027:"},{"line_number":113,"context_line":"            policy \u003d POLICIES.get_by_index("},{"line_number":114,"context_line":"                info.get(\u0027storage_policy_index\u0027) or 0)"},{"line_number":115,"context_line":"            print (\u0027  Storage Policy: %s\u0027 % policy.name)"},{"line_number":116,"context_line":"            print (\u0027  Reported Put Timestamp: %s (%s)\u0027 %"},{"line_number":117,"context_line":"                   (datetime.utcfromtimestamp("},{"line_number":118,"context_line":"                    float(info[\u0027reported_put_timestamp\u0027])),"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAW3%2F%2F4Jk%3D","line":115,"updated":"2014-04-09 18:28:20.000000000","message":"I\u0027ve been liking the __getitem__ syntax lately:\n\nPOLICIES[info[\u0027storage_policy_index\u0027]]\n\n^ get_info always returns a storage_policy_index even if the container_stat table doesn\u0027t have the field so the \"or 0\" part is already handled for you.\n\nAlso I think get_by_index can return None, which won\u0027t have a .name attribute, so you get a weird error if your swift.conf isn\u0027t up to snuff for the container (which could be annoying cause you won\u0027t even know what storage policy index you\u0027re missing!)\n\nprobably better:\n\n    try:\n        policy_name \u003d POLICIES[info[\u0027storage_policy_index\u0027]]\n    except KeyError:\n        policy_name \u003d \u0027Unknown\u0027\n    print \u0027Storage Policy: %s (%s)\u0027 % (policy_name, info[\u0027storage_policy_index\u0027])","commit_id":"e4debb2b63c19f1ea31168c1210774554ca8394f"}]}
