Fix handle python-dns UnicodeError

Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
Martin Basti 2014-06-20 12:53:06 +02:00 committed by Martin Kosek
parent 11c250a612
commit 9f5e77f686

View File

@ -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