summaryrefslogtreecommitdiffstats
path: root/ipapython
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2016-01-05 14:03:50 +0100
committerJan Cholasta <jcholast@redhat.com>2016-01-20 11:59:21 +0100
commit983c53bb6ca68edf6ee0d571dd27abf1af1d06bc (patch)
tree7a674995d1a32eadf41e1eea22a4aa182878f66b /ipapython
parent06a678c1592928403d7619e11dc0fdb6828d51f9 (diff)
downloadfreeipa-983c53bb6ca68edf6ee0d571dd27abf1af1d06bc.tar.gz
freeipa-983c53bb6ca68edf6ee0d571dd27abf1af1d06bc.tar.xz
freeipa-983c53bb6ca68edf6ee0d571dd27abf1af1d06bc.zip
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 <jcholast@redhat.com> Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'ipapython')
-rw-r--r--ipapython/dnsutil.py4
1 files changed, 3 insertions, 1 deletions
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)