From: Bob Halley Date: Fri, 2 Sep 2005 05:33:17 +0000 (+0000) Subject: fix problem throwing FormErr when responding to a response X-Git-Tag: v1.3.4~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36afc883717f9f62dfd63a64c17035b9b2e5498d;p=thirdparty%2Fdnspython.git fix problem throwing FormErr when responding to a response Original author: Bob Halley Date: 2005-08-01 03:32:11 --- diff --git a/ChangeLog b/ChangeLog index 81d5263b..26bf5904 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,15 @@ -2005-06-05 Bob Halley +2005-07-31 Bob Halley + + * dns/message.py (make_response): Trying to respond to a response + threw a NameError while trying to throw a FormErr since it used + the wrong name for the FormErr exception. + +2005-06-05 Bob Halley * dns/query.py: The requirement that the "where" parameter be an IPv4 or IPv6 address is now documented. -2005-06-04 Bob Halley +2005-06-04 Bob Halley * dns/resolver.py: The resolver now does exponential backoff each time it runs through all of the nameservers. diff --git a/dns/message.py b/dns/message.py index eae57180..081540c7 100644 --- a/dns/message.py +++ b/dns/message.py @@ -987,7 +987,7 @@ def make_response(query, recursion_available=False, our_payload=8192): @rtype: dns.message.Message object""" if query.flags & dns.flags.QR: - raise FormError, 'specified query message is not a query' + raise dns.exception.FormError, 'specified query message is not a query' response = dns.message.Message(query.id) response.flags = dns.flags.QR | (query.flags & dns.flags.RD) if recursion_available: diff --git a/tests/message.py b/tests/message.py index cbe79361..0a35f42e 100644 --- a/tests/message.py +++ b/tests/message.py @@ -156,5 +156,12 @@ class MessageTestCase(unittest.TestCase): m = dns.message.from_wire(badwire) self.failUnlessRaises(dns.message.ShortHeader, bad) + def test_RespondingToResponse(self): + def bad(): + q = dns.message.make_query('foo', 'A') + r1 = dns.message.make_response(q) + r2 = dns.message.make_response(r1) + self.failUnlessRaises(dns.exception.FormError, bad) + if __name__ == '__main__': unittest.main()