mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-08-13 06:25:00 -05:00
Use six.python_2_unicode_compatible
Rename __unicode__ to __str__ in classes which define it and use the six.python_2_unicode_compatible decorator on them to make them compatible with both Python 2 and 3. Additional changes were required for the ipapython.dnsutil.DNSName class, because it defined both __str__ and __unicode__. Reviewed-By: Petr Viktorin <pviktori@redhat.com>
This commit is contained in:
@@ -833,7 +833,7 @@ class LDAPClient(object):
|
||||
elif isinstance(val, (unicode, six.integer_types, long, Decimal, DN)):
|
||||
return value_to_utf8(val)
|
||||
elif isinstance(val, DNSName):
|
||||
return str(val)
|
||||
return val.to_text()
|
||||
elif isinstance(val, str):
|
||||
return val
|
||||
elif isinstance(val, list):
|
||||
@@ -863,6 +863,8 @@ class LDAPClient(object):
|
||||
return val.decode('utf-8')
|
||||
elif target_type is datetime.datetime:
|
||||
return datetime.datetime.strptime(val, LDAP_GENERALIZED_TIME_FORMAT)
|
||||
elif target_type is DNSName:
|
||||
return DNSName.from_text(val)
|
||||
else:
|
||||
return target_type(val)
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user