Reviewed: https://review.openstack.org/252876 Committed: https://git.openstack.org/cgit/openstack/python-neutronclient/commit/?id=c5e1d2b827e16b761aa9601355fc91d969527d73 Submitter: Jenkins Branch: stable/liberty
commit c5e1d2b827e16b761aa9601355fc91d969527d73 Author: Cedric Brandily <email address hidden> Date: Tue Oct 6 22:22:09 2015 +0200
Ensure to decode bytes or fail
The commit fcf289797c063088f9003359dfd1c7d4f41ed5ef introduces the pattern:
if isinstance(line, bytes): try: line = line.decode(encoding='utf-8') except UnicodeError: pass # concat line with a string
which is not working in PY3K if an UnicodeError is raised because line is not decoded and concatened to a string.
This change delegates decoding to safe_decode[1] which returns a text object or raises an error.
[1] oslo_utils.encodeutils
Closes-Bug: #1503415 Related-Bug: #1499004 Change-Id: I16b8013f33aa3efad65be8040d3210120e047bbd (cherry picked from commit 88eb5845b77fa06a12c096706093329f82dba54c)
Reviewed: https:/ /review. openstack. org/252876 /git.openstack. org/cgit/ openstack/ python- neutronclient/ commit/ ?id=c5e1d2b827e 16b761aa9601355 fc91d969527d73
Committed: https:/
Submitter: Jenkins
Branch: stable/liberty
commit c5e1d2b827e16b7 61aa9601355fc91 d969527d73
Author: Cedric Brandily <email address hidden>
Date: Tue Oct 6 22:22:09 2015 +0200
Ensure to decode bytes or fail
The commit fcf289797c06308 8f9003359dfd1c7 d4f41ed5ef introduces the
pattern:
if isinstance(line, bytes): encoding= 'utf-8' )
try:
line = line.decode(
except UnicodeError:
pass
# concat line with a string
which is not working in PY3K if an UnicodeError is raised because line
is not decoded and concatened to a string.
This change delegates decoding to safe_decode[1] which returns a text
object or raises an error.
[1] oslo_utils. encodeutils
Closes-Bug: #1503415 fad65be8040d321 0120e047bbd a12c09670609332 9f82dba54c)
Related-Bug: #1499004
Change-Id: I16b8013f33aa3e
(cherry picked from commit 88eb5845b77fa06