)]}'
{"oslo_log/handlers.py":[{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"ea0bfdf851cdd1551227c34c0114a7aa802323a6","unresolved":false,"context_lines":[{"line_number":60,"context_line":""},{"line_number":61,"context_line":"            # NOTE(gangila): Only if string is not in unicode format encode."},{"line_number":62,"context_line":"            if not isinstance(message, six.text_type):"},{"line_number":63,"context_line":"                message \u003d encodeutils.safe_encode(self.format(record))"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"            syslog.syslog(priority, message)"},{"line_number":66,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_f8f11296","line":63,"updated":"2016-11-29 01:29:20.000000000","message":"Does this do what we want on py2?","commit_id":"cbb135a9b388b9f978864b7a5e038504ebaba4c5"},{"author":{"_account_id":12134,"name":"Akash Gangil","email":"akashg1611@gmail.com","username":"akash"},"change_message_id":"32fcfdcfa50a65b5e3f1104bc3e153eee8870e76","unresolved":false,"context_lines":[{"line_number":60,"context_line":""},{"line_number":61,"context_line":"            # NOTE(gangila): Only if string is not in unicode format encode."},{"line_number":62,"context_line":"            if not isinstance(message, six.text_type):"},{"line_number":63,"context_line":"                message \u003d encodeutils.safe_encode(self.format(record))"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"            syslog.syslog(priority, message)"},{"line_number":66,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_f34855ce","line":63,"in_reply_to":"5a74a57a_d80a9625","updated":"2016-11-29 02:00:21.000000000","message":"I was trying to handle case where user in python3 sends a bytes type, but that would still fail here. In that case we should only decode.\n\nbut on checking again that would still fail as in this clause, \n\n    elif text and encoding !\u003d incoming:\n100\t        # Decode text before encoding it with `encoding`\n101\t        text \u003d safe_decode(text, incoming, errors)\n102\t        return text.encode(encoding, errors)\n\nwe decode but again encode in the line 102. \n\nwhere all we needed was decode()\n\u003e\u003e\u003e n \u003d b\u0027a\u0027\n\u003e\u003e\u003e type(n.decode(\u0027utf-8\u0027))\n\u003cclass \u0027str\u0027\u003e\n\nI see it more of oslo.utils issue now, than oslo.log. osloutil is breaking in python3 when the user expects to encode a string as utf-8.**Give the fact that utf-8 although a binary encoding need to be represented by \u0027str\u0027 in python3.","commit_id":"cbb135a9b388b9f978864b7a5e038504ebaba4c5"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"b978dcaff5e3b7b919d988b759d7454d8202b1ef","unresolved":false,"context_lines":[{"line_number":60,"context_line":""},{"line_number":61,"context_line":"            # NOTE(gangila): Only if string is not in unicode format encode."},{"line_number":62,"context_line":"            if not isinstance(message, six.text_type):"},{"line_number":63,"context_line":"                message \u003d encodeutils.safe_encode(self.format(record))"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"            syslog.syslog(priority, message)"},{"line_number":66,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_d80a9625","line":63,"in_reply_to":"5a74a57a_d8d9b6f4","updated":"2016-11-29 01:40:36.000000000","message":"Why not just do the following then.\n\n  if six.PY2:\n     message \u003d encodeutils.safe_encode(self.format(record))\n\nThat is what u want anyway right?","commit_id":"cbb135a9b388b9f978864b7a5e038504ebaba4c5"},{"author":{"_account_id":12134,"name":"Akash Gangil","email":"akashg1611@gmail.com","username":"akash"},"change_message_id":"f3ad4c3feab0ab07f93be32e23e7b9c45c42c5b8","unresolved":false,"context_lines":[{"line_number":60,"context_line":""},{"line_number":61,"context_line":"            # NOTE(gangila): Only if string is not in unicode format encode."},{"line_number":62,"context_line":"            if not isinstance(message, six.text_type):"},{"line_number":63,"context_line":"                message \u003d encodeutils.safe_encode(self.format(record))"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"            syslog.syslog(priority, message)"},{"line_number":66,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_d8d9b6f4","line":63,"in_reply_to":"5a74a57a_f8f11296","updated":"2016-11-29 01:34:33.000000000","message":"Yes, atleast  in my testing. The type(message) in python2 was \u0027str\u0027 while six.text_type resolved to unicode. [1] \n\n\n[1] https://pythonhosted.org/six/#six.text_type","commit_id":"cbb135a9b388b9f978864b7a5e038504ebaba4c5"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"559418cdbcc64ad4189009636353151db62207fd","unresolved":false,"context_lines":[{"line_number":59,"context_line":"            message \u003d self.format(record)"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"            if six.PY2:"},{"line_number":62,"context_line":"                message \u003d encodeutils.safe_encode(self.format(record))"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"            syslog.syslog(priority, message)"},{"line_number":65,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_d9f36171","line":62,"updated":"2016-11-29 13:22:05.000000000","message":"If syslog always needs to be given a unicode object, is it ever right to call safe_encode()?","commit_id":"12ae9310adcdeb21d75b88e948ec812ce909c1cc"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"41d4ab1b301fcbad58d49e701499ca2429d01c3e","unresolved":false,"context_lines":[{"line_number":79,"context_line":"            # encoding is \u0027utf-8\u0027 works without any issues. Therefore, we need"},{"line_number":80,"context_line":"            # to safe_encode in case of python2 and not in case of Python3."},{"line_number":81,"context_line":"            if six.PY2:"},{"line_number":82,"context_line":"                message \u003d encodeutils.safe_encode(self.format(record))"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"            syslog.syslog(priority, message)"},{"line_number":85,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_6d146b4c","line":82,"range":{"start_line":82,"start_character":16,"end_line":82,"end_character":70},"updated":"2016-12-06 15:54:38.000000000","message":"nit:\n\nmessage \u003d encodeutils.safe_encode(message)","commit_id":"92f87422ad1f013b96ffdca51e6dad1737e9905f"}]}
