summaryrefslogtreecommitdiffstats
path: root/ipapython
diff options
context:
space:
mode:
Diffstat (limited to 'ipapython')
-rw-r--r--ipapython/dnsutil.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/ipapython/dnsutil.py b/ipapython/dnsutil.py
index 16549c8f6..011b722da 100644
--- a/ipapython/dnsutil.py
+++ b/ipapython/dnsutil.py
@@ -69,9 +69,14 @@ class DNSName(dns.name.Name):
def __str__(self):
return self.to_unicode()
- def ToASCII(self):
- #method named by RFC 3490 and python standard library
- return self.to_text().decode('ascii') # must be unicode string
+ # method ToASCII named by RFC 3490 and python standard library
+ if six.PY2:
+ def ToASCII(self):
+ # must be unicode string in Py2
+ return self.to_text().decode('ascii')
+ else:
+ def ToASCII(self):
+ return self.to_text()
def canonicalize(self):
return DNSName(super(DNSName, self).canonicalize())