]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
fix problem throwing FormErr when responding to a response
authorBob Halley <halley@dnspython.org>
Fri, 2 Sep 2005 05:33:17 +0000 (05:33 +0000)
committerBob Halley <halley@dnspython.org>
Fri, 2 Sep 2005 05:33:17 +0000 (05:33 +0000)
Original author: Bob Halley <halley@dnspython.org>
Date: 2005-08-01 03:32:11

ChangeLog
dns/message.py
tests/message.py

index 81d5263bc0d605fd9a693b66a65a6bc8f0e7287b..26bf59040a199db825bafc91d7149e34288f0375 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,15 @@
-2005-06-05  Bob Halley  <halley@nominum.com>
+2005-07-31  Bob Halley  <halley@dnspython.org>
+
+       * 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  <halley@dnspython.org>
 
        * dns/query.py: The requirement that the "where" parameter be
          an IPv4 or IPv6 address is now documented.
 
-2005-06-04  Bob Halley  <halley@nominum.com>
+2005-06-04  Bob Halley  <halley@dnspython.org>
 
        * dns/resolver.py: The resolver now does exponential backoff
          each time it runs through all of the nameservers.
index eae57180177b1dfe62c8a8b4d7fe7baa99427af1..081540c7e506ef6fac860051c0ae14461e9667b7 100644 (file)
@@ -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:
index cbe79361c66670ea131658d9397bf472cc113e4d..0a35f42edf5bbbb51508742b8ac1b17015e46e9f 100644 (file)
@@ -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()