diff options
author | Petr Viktorin <pviktori@redhat.com> | 2016-01-05 14:03:50 +0100 |
---|---|---|
committer | Jan Cholasta <jcholast@redhat.com> | 2016-01-20 11:59:21 +0100 |
commit | 983c53bb6ca68edf6ee0d571dd27abf1af1d06bc (patch) | |
tree | 7a674995d1a32eadf41e1eea22a4aa182878f66b /ipapython/dnsutil.py | |
parent | 06a678c1592928403d7619e11dc0fdb6828d51f9 (diff) | |
download | freeipa-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/dnsutil.py')
-rw-r--r-- | ipapython/dnsutil.py | 4 |
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) |