diff options
author | Martin Basti <mbasti@redhat.com> | 2014-06-20 12:53:06 +0200 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2014-06-20 13:28:53 +0200 |
commit | 9f5e77f686a974b837da6eb92cec741fcbb33603 (patch) | |
tree | 94ffd16958fa27e4802b79f62ee98b6940291a97 /ipapython/dnsutil.py | |
parent | 11c250a6125da300f85880e090e5db1659078daa (diff) | |
download | freeipa-9f5e77f686a974b837da6eb92cec741fcbb33603.tar.gz freeipa-9f5e77f686a974b837da6eb92cec741fcbb33603.tar.xz freeipa-9f5e77f686a974b837da6eb92cec741fcbb33603.zip |
Fix handle python-dns UnicodeError
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipapython/dnsutil.py')
-rw-r--r-- | ipapython/dnsutil.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ipapython/dnsutil.py b/ipapython/dnsutil.py index 9c91578a8..3602d22cd 100644 --- a/ipapython/dnsutil.py +++ b/ipapython/dnsutil.py @@ -18,6 +18,7 @@ # import dns.name +import dns.exception import copy @@ -35,10 +36,10 @@ class DNSName(dns.name.Name): labels = labels.labels try: super(DNSName, self).__init__(labels) - except UnicodeError: - #dnspython bug, punycoded label longer than 63 returns UnicodeError - #instead of LabelTooLong - raise dns.name.LabelTooLong() + except UnicodeError, e: + # dnspython bug, an invalid domain name returns the UnicodeError + # instead of a dns.exception + raise dns.exception.SyntaxError(e) def __nonzero__(self): #dns.name.from_text('@') is represented like empty tuple |