From ba5201979dfddcb4ca6bb1b68e786cb964e50bb6 Mon Sep 17 00:00:00 2001 From: Jan Cholasta Date: Fri, 11 Sep 2015 14:02:13 +0200 Subject: Use bytes instead of str where appropriate Under Python 2, "str" and "bytes" are synonyms. Reviewed-By: Petr Viktorin --- ipalib/plugins/baseldap.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ipalib/plugins') diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py index 81fae1516..4a0224647 100644 --- a/ipalib/plugins/baseldap.py +++ b/ipalib/plugins/baseldap.py @@ -248,7 +248,7 @@ def entry_to_dict(entry, **options): for attr in entry: if attr.lower() == 'attributelevelrights': value = entry[attr] - elif entry.conn.get_attribute_type(attr) is str: + elif entry.conn.get_attribute_type(attr) is bytes: value = entry.raw[attr] else: value = list(entry.raw[attr]) @@ -1082,7 +1082,7 @@ last, after all sets and adds."""), try: entry_attrs[attr].remove(delval) except ValueError: - if isinstance(delval, str): + if isinstance(delval, bytes): # This is a Binary value, base64 encode it delval = unicode(base64.b64encode(delval)) raise errors.AttrValueNotFound(attr=attr, value=delval) -- cgit