Fix exceptions for Python3

This commit is contained in:
Lance Stout 2011-08-18 00:47:07 -07:00
parent 4ea22ff69b
commit cd7cd30b4c
2 changed files with 2 additions and 2 deletions

View file

@ -145,7 +145,7 @@ class ClientXMPP(BaseXMPP):
if DNSPYTHON: if DNSPYTHON:
try: try:
answers = [((answer.target.to_text()[:-1], answer.port), answer.priority, answer.weight) for answer in dns.resolver.query("_xmpp-client._tcp.%s" % domain, dns.rdatatype.SRV)] answers = [((answer.target.to_text()[:-1], answer.port), answer.priority, answer.weight) for answer in dns.resolver.query("_xmpp-client._tcp.%s" % domain, dns.rdatatype.SRV)]
except dns.resolver.NXDOMAIN, dns.resolver.NoAnswer: except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
log.warning("No SRV records for %s" % domain) log.warning("No SRV records for %s" % domain)
answers = super(ClientXMPP, self).get_dns_records(domain, port) answers = super(ClientXMPP, self).get_dns_records(domain, port)
except dns.exception.Timeout: except dns.exception.Timeout:

View file

@ -662,7 +662,7 @@ class XMLStream(object):
if DNSPYTHON: if DNSPYTHON:
try: try:
answers = dns.resolver.query(domain, dns.rdatatype.A) answers = dns.resolver.query(domain, dns.rdatatype.A)
except dns.resolver.NXDOMAIN, dns.resolver.NoAnswer: except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
log.warning("No A records for %s" % domain) log.warning("No A records for %s" % domain)
except dns.exception.Timeout: except dns.exception.Timeout:
log.warning("DNS resolution timed out for A record of %s" % domain) log.warning("DNS resolution timed out for A record of %s" % domain)