)]}'
{"neutron/plugins/cisco/n1kv/n1kv_client.py":[{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"54bf366b37b46f0ecdc03aa135baf029364c76af","unresolved":false,"context_lines":[{"line_number":506,"context_line":"        to_encode \u003d \"%s:%s\" % (username, password)"},{"line_number":507,"context_line":"        if six.PY3:"},{"line_number":508,"context_line":"            to_encode \u003d to_encode.encode()"},{"line_number":509,"context_line":"        auth \u003d base64.encodestring(to_encode).rstrip()"},{"line_number":510,"context_line":"        if six.PY3:"},{"line_number":511,"context_line":"            auth \u003d auth.decode()"},{"line_number":512,"context_line":"        header \u003d {\"Authorization\": \"Basic %s\" % auth}"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a50d1a3_65ef8e1e","line":509,"updated":"2015-07-28 15:48:47.000000000","message":"meh. can we have some util method that will do it for us, like \u0027safe_encodestring\u0027?","commit_id":"2986d9c48244ef1ed114384647719b2856e0850b"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"075839116dc3c13accc009d2bc9c635e3d4efa96","unresolved":false,"context_lines":[{"line_number":506,"context_line":"        to_encode \u003d \"%s:%s\" % (username, password)"},{"line_number":507,"context_line":"        if six.PY3:"},{"line_number":508,"context_line":"            to_encode \u003d to_encode.encode()"},{"line_number":509,"context_line":"        auth \u003d base64.encodestring(to_encode).rstrip()"},{"line_number":510,"context_line":"        if six.PY3:"},{"line_number":511,"context_line":"            auth \u003d auth.decode()"},{"line_number":512,"context_line":"        header \u003d {\"Authorization\": \"Basic %s\" % auth}"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a50d1a3_324f5193","line":509,"in_reply_to":"3a50d1a3_12dfb50d","updated":"2015-07-29 15:10:36.000000000","message":"I am fine having it in this module as a helper util function. Just let\u0027s not bloat the method with PY3.","commit_id":"2986d9c48244ef1ed114384647719b2856e0850b"},{"author":{"_account_id":9107,"name":"Victor Stinner","email":"vstinner@redhat.com","username":"haypo"},"change_message_id":"64623771ced3171407c33e5ed0fb36f33615484d","unresolved":false,"context_lines":[{"line_number":506,"context_line":"        to_encode \u003d \"%s:%s\" % (username, password)"},{"line_number":507,"context_line":"        if six.PY3:"},{"line_number":508,"context_line":"            to_encode \u003d to_encode.encode()"},{"line_number":509,"context_line":"        auth \u003d base64.encodestring(to_encode).rstrip()"},{"line_number":510,"context_line":"        if six.PY3:"},{"line_number":511,"context_line":"            auth \u003d auth.decode()"},{"line_number":512,"context_line":"        header \u003d {\"Authorization\": \"Basic %s\" % auth}"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a50d1a3_12dfb50d","line":509,"in_reply_to":"3a50d1a3_65ef8e1e","updated":"2015-07-29 15:07:17.000000000","message":"\u003e meh. can we have some util method that will do it for us, like \u0027safe_encodestring\u0027?\n\noslo.utils has a safe_encode() function, but I hate its API:\nhttps://wiki.openstack.org/wiki/Python3#safe_encode\n\nI prefer two lines of explicit code, it\u0027s easier to understand. You may write the following code to support also Unicode on Python 2 and make the code even more obvious:\n\nif isinstance(to_encode, six.text_type):\n    to_encode \u003d to_encode.encode(\u0027utf-8\u0027)\n\nNote: please explicit the encoding, it avoids surprises (especially on Python 2 where the default encoding is ASCII, not UTF-8).\n\nIt might be nice to have base64 and JSON helpers in oslo.utils to encode/decode, but such code is rare.","commit_id":"2986d9c48244ef1ed114384647719b2856e0850b"},{"author":{"_account_id":8122,"name":"Cyril Roelandt","email":"cyril@redhat.com","username":"cyril.roelandt.enovance"},"change_message_id":"d09bb0408927db6714c1d220d305e30e0f03f970","unresolved":false,"context_lines":[{"line_number":506,"context_line":"        to_encode \u003d \"%s:%s\" % (username, password)"},{"line_number":507,"context_line":"        if six.PY3:"},{"line_number":508,"context_line":"            to_encode \u003d to_encode.encode()"},{"line_number":509,"context_line":"        auth \u003d base64.encodestring(to_encode).rstrip()"},{"line_number":510,"context_line":"        if six.PY3:"},{"line_number":511,"context_line":"            auth \u003d auth.decode()"},{"line_number":512,"context_line":"        header \u003d {\"Authorization\": \"Basic %s\" % auth}"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a50d1a3_d23e2d8a","line":509,"in_reply_to":"3a50d1a3_65ef8e1e","updated":"2015-07-29 15:00:44.000000000","message":"Hmm, not really, I don\u0027t think so.\n\nMaybe this could be added to Olso. Victor ?\n\nThere is only one use of base64.encodestring in Neutron, though.","commit_id":"2986d9c48244ef1ed114384647719b2856e0850b"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"342585e4529d79f7816c85b85441213e1556db3d","unresolved":false,"context_lines":[{"line_number":506,"context_line":"        to_encode \u003d \"%s:%s\" % (username, password)"},{"line_number":507,"context_line":"        if six.PY3:"},{"line_number":508,"context_line":"            to_encode \u003d to_encode.encode()"},{"line_number":509,"context_line":"        auth \u003d base64.encodestring(to_encode).rstrip()"},{"line_number":510,"context_line":"        if six.PY3:"},{"line_number":511,"context_line":"            auth \u003d auth.decode()"},{"line_number":512,"context_line":"        header \u003d {\"Authorization\": \"Basic %s\" % auth}"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a50d1a3_f20fa9dd","line":509,"in_reply_to":"3a50d1a3_d23e2d8a","updated":"2015-07-29 15:02:31.000000000","message":"Yeah, but having it here with all those PY3 checks seems bloat.","commit_id":"2986d9c48244ef1ed114384647719b2856e0850b"},{"author":{"_account_id":14615,"name":"Sergey Belous","email":"belous.py@gmail.com","username":"sbelous"},"change_message_id":"bf9cc32ab74f5440bcc5e963d2b36efcae6c9ccd","unresolved":false,"context_lines":[{"line_number":46,"context_line":"    if six.PY3:"},{"line_number":47,"context_line":"        return encoded_string.decode(\u0027utf-8\u0027)"},{"line_number":48,"context_line":"    else:"},{"line_number":49,"context_line":"        return encoded_string"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"class Client(object):"},{"line_number":52,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"3a50d1a3_aa4388ae","line":49,"updated":"2015-07-31 11:19:04.000000000","message":"Is it OK, that in this case \u0027\\n\u0027 symbol added in the end of encoded_string? Maybe there should be encoded_string.rstrip()?","commit_id":"e2b16de7a4c7022e8e8c34c351964d68b59ffc90"},{"author":{"_account_id":9107,"name":"Victor Stinner","email":"vstinner@redhat.com","username":"haypo"},"change_message_id":"3778b584bd1c35e5bcc78ef1a73d1980c7af03d4","unresolved":false,"context_lines":[{"line_number":33,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":34,"context_line":""},{"line_number":35,"context_line":""},{"line_number":36,"context_line":"def safe_b64_encode(s):"},{"line_number":37,"context_line":"    if six.PY3:"},{"line_number":38,"context_line":"        method \u003d base64.encodebytes"},{"line_number":39,"context_line":"    else:"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a50d1a3_4fa44f4a","line":36,"updated":"2015-07-31 13:14:44.000000000","message":"You may put the \"if six.PY3:\" outside the function, since most of the code changes depending on the major python version.\n\n if six.PY3:\n     def safe_base64_encode(s): ...\n else:\n     def safe_base64_encode(s): ...","commit_id":"945a752e400f41c30016932ff8767f291b61b9f8"},{"author":{"_account_id":9107,"name":"Victor Stinner","email":"vstinner@redhat.com","username":"haypo"},"change_message_id":"3778b584bd1c35e5bcc78ef1a73d1980c7af03d4","unresolved":false,"context_lines":[{"line_number":519,"context_line":"        \"\"\""},{"line_number":520,"context_line":"        username \u003d c_cred.Store.get_username(host_ip)"},{"line_number":521,"context_line":"        password \u003d c_cred.Store.get_password(host_ip)"},{"line_number":522,"context_line":"        auth \u003d safe_b64_encode(\"%s:%s\" % (username, password))"},{"line_number":523,"context_line":"        header \u003d {\"Authorization\": \"Basic %s\" % auth}"},{"line_number":524,"context_line":"        return header"},{"line_number":525,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"3a50d1a3_2f80e38a","line":522,"updated":"2015-07-31 13:14:44.000000000","message":"You should keep the .rstrip() here, or put it in safe_b64_encode().\n\nI prefer to put it in safe_b64_encode().","commit_id":"945a752e400f41c30016932ff8767f291b61b9f8"}]}
