py3: DN: fix BytesWarning

User repr() instead of str() for bytes, it has the same effect, but it
is proper way how to print bytes

https://fedorahosted.org/freeipa/ticket/4985

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
This commit is contained in:
Martin Basti
2017-02-02 15:48:19 +01:00
parent ad1a5551d5
commit d38540acd6

View File

@@ -452,7 +452,7 @@ def _adjust_indices(start, end, length):
def _normalize_ava_input(val):
if six.PY3 and isinstance(val, bytes):
raise TypeError('expected str, got bytes: %s' % val)
raise TypeError('expected str, got bytes: %r' % val)
elif not isinstance(val, six.string_types):
val = val_encode(six.text_type(val))
elif six.PY2 and isinstance(val, unicode):