diff options
| author | Bob Halley <halley@nominum.com> | 2010-01-14 14:51:06 -0800 |
|---|---|---|
| committer | Bob Halley <halley@nominum.com> | 2010-01-14 14:51:06 -0800 |
| commit | 53cb0eb5cfb463ebd0fdad55026ba25ac5c898d4 (patch) | |
| tree | 10328f74009a1bdb93a5b924df5f1610417e370c /dns/query.py | |
| parent | 4fbaa1dce221a1bd1b24c5c5e88bab088c13be9f (diff) | |
| download | dnspython-53cb0eb5cfb463ebd0fdad55026ba25ac5c898d4.tar.gz | |
create exceptions with arguments as "raise E(args)" instead of "raise E, args"
Diffstat (limited to 'dns/query.py')
| -rw-r--r-- | dns/query.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/dns/query.py b/dns/query.py index a907df0..c023b14 100644 --- a/dns/query.py +++ b/dns/query.py @@ -140,9 +140,9 @@ def udp(q, where, timeout=None, port=53, af=None, source=None, source_port=0, from_address[1:] == destination[1:]): break if not ignore_unexpected: - raise UnexpectedSource, \ - 'got a response from %s instead of %s' % (from_address, - destination) + raise UnexpectedSource('got a response from ' + '%s instead of %s' % (from_address, + destination)) finally: s.close() r = dns.message.from_wire(wire, keyring=q.keyring, request_mac=q.mac, @@ -186,7 +186,7 @@ def _connect(s, address): if v[0] != errno.EINPROGRESS and \ v[0] != errno.EWOULDBLOCK and \ v[0] != errno.EALREADY: - raise ty, v + raise v def tcp(q, where, timeout=None, port=53, af=None, source=None, source_port=0, one_rr_per_rrset=False): @@ -335,7 +335,7 @@ def xfr(where, zone, rdtype=dns.rdatatype.AXFR, rdclass=dns.rdataclass.IN, source = (source, source_port, 0, 0) if use_udp: if rdtype != dns.rdatatype.IXFR: - raise ValueError, 'cannot do a UDP AXFR' + raise ValueError('cannot do a UDP AXFR') s = socket.socket(af, socket.SOCK_DGRAM, 0) else: s = socket.socket(af, socket.SOCK_STREAM, 0) @@ -387,7 +387,7 @@ def xfr(where, zone, rdtype=dns.rdatatype.AXFR, rdclass=dns.rdataclass.IN, raise dns.exception.FormError rrset = r.answer[0] if rrset.rdtype != dns.rdatatype.SOA: - raise dns.exception.FormError, "first RRset is not an SOA" + raise dns.exception.FormError("first RRset is not an SOA") answer_index = 1 soa_rrset = rrset.copy() if rdtype == dns.rdatatype.IXFR: @@ -404,12 +404,11 @@ def xfr(where, zone, rdtype=dns.rdatatype.AXFR, rdclass=dns.rdataclass.IN, # for rrset in r.answer[answer_index:]: if done: - raise dns.exception.FormError, "answers after final SOA" + raise dns.exception.FormError("answers after final SOA") if rrset.rdtype == dns.rdatatype.SOA and rrset.name == oname: if expecting_SOA: if rrset[0].serial != serial: - raise dns.exception.FormError, \ - "IXFR base serial mismatch" + raise dns.exception.FormError("IXFR base serial mismatch") expecting_SOA = False elif rdtype == dns.rdatatype.IXFR: delete_mode = not delete_mode @@ -424,6 +423,6 @@ def xfr(where, zone, rdtype=dns.rdatatype.AXFR, rdclass=dns.rdataclass.IN, rdtype = dns.rdatatype.AXFR expecting_SOA = False if done and q.keyring and not r.had_tsig: - raise dns.exception.FormError, "missing TSIG" + raise dns.exception.FormError("missing TSIG") yield r s.close() |
