switch basestring for bytes in HumanReadableException

We already check for unicode first, so this shouldn't cause any issues
on py2
This commit is contained in:
Johnny Robeson 2016-06-18 02:11:24 -04:00
parent 66431ab4de
commit 33d451ed2d

View file

@ -67,7 +67,7 @@ class HumanReadableException(Exception):
"""Get the reason as a string."""
if isinstance(self.reason, unicode):
return self.reason
elif isinstance(self.reason, basestring): # Byte string.
elif isinstance(self.reason, bytes):
return self.reason.decode('utf8', 'ignore')
elif hasattr(self.reason, 'strerror'): # i.e., EnvironmentError
return self.reason.strerror