From 983c53bb6ca68edf6ee0d571dd27abf1af1d06bc Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Tue, 5 Jan 2016 14:03:50 +0100 Subject: dnsutil: Rename __nonzero__ to __bool__ In Python 3, this special method got renamed. Set both to the same function to keep compatibility. https://fedorahosted.org/freeipa/ticket/5623 Reviewed-By: Jan Cholasta Reviewed-By: Martin Basti --- ipapython/dnsutil.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ipapython') diff --git a/ipapython/dnsutil.py b/ipapython/dnsutil.py index a11d744d7..18141fa09 100644 --- a/ipapython/dnsutil.py +++ b/ipapython/dnsutil.py @@ -49,11 +49,13 @@ class DNSName(dns.name.Name): # instead of a dns.exception raise dns.exception.SyntaxError(e) - def __nonzero__(self): + def __bool__(self): #dns.name.from_text('@') is represented like empty tuple #we need to acting '@' as nonzero value return True + __nonzero__ = __bool__ # for Python 2 + def __copy__(self): return DNSName(self.labels) -- cgit