mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-26 08:51:50 -06:00
dns plugin: Fix zone normalization under Python 3
In Python 3, str.encode('ascii') converts to bytes, and str() (nicknamed unicode() in IPA) returns the string representation of an object, which is b'...' for bytes. So, unicode('...'.encode('ascii')) results in "b'...'". Change the code to only call encode() for the error. Part of the work for https://fedorahosted.org/freeipa/ticket/4985 Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
parent
8689e6be51
commit
28b0bfaefe
@ -1755,9 +1755,11 @@ def _normalize_zone(zone):
|
|||||||
if isinstance(zone, unicode):
|
if isinstance(zone, unicode):
|
||||||
# normalize only non-IDNA zones
|
# normalize only non-IDNA zones
|
||||||
try:
|
try:
|
||||||
return unicode(zone.encode('ascii')).lower()
|
zone.encode('ascii')
|
||||||
except UnicodeError:
|
except UnicodeError:
|
||||||
pass
|
pass
|
||||||
|
else:
|
||||||
|
return zone.lower()
|
||||||
return zone
|
return zone
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user