]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
present() did not add a zero TTL if its argument was a single rdata
authorBob Halley <halley@nominum.com>
Thu, 12 Nov 2009 18:39:14 +0000 (03:39 +0900)
committerBob Halley <halley@nominum.com>
Thu, 12 Nov 2009 18:39:14 +0000 (03:39 +0900)
ChangeLog
dns/update.py

index a28042fc0ffe29092fcdfb3c05e4b2cfbaa4ef9c..6b9cc5004b673d2249925f585f4d5c8d0f67d0d0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-11-13  Bob Halley  <halley@nominum.com>
+
+       * dns/update.py (Update::present): A zero TTL was not added if
+         present() was called with a single rdata, causing _add() to be
+         unhappy.  Thanks to Eugene Kim for reporting the problem and
+         submitting a patch.
+
 2009-11-13  Bob Halley  <halley@dnspython.org>
 
        * dns/entropy.py: Use os.urandom() if present.  Don't seed until
index f54a51be057f10521c1a79e564527f5d7a137d4c..5bd289f7d10f2f64eaca83bf0faa8ada9c598f97 100644 (file)
@@ -26,7 +26,7 @@ class Update(dns.message.Message):
     def __init__(self, zone, rdclass=dns.rdataclass.IN, keyring=None,
                  keyname=None):
         """Initialize a new DNS Update object.
-        
+
         @param zone: The zone which is being updated.
         @type zone: A dns.name.Name or string
         @param rdclass: The class of the zone; defaults to dns.rdataclass.IN.
@@ -72,7 +72,7 @@ class Update(dns.message.Message):
         argument is the section to add to.  The third argument
         is always a name.  The other arguments can be:
 
-               - rdataset...
+                - rdataset...
 
                 - ttl, rdata...
 
@@ -109,7 +109,7 @@ class Update(dns.message.Message):
         """Add records.  The first argument is always a name.  The other
         arguments can be:
 
-               - rdataset...
+                - rdataset...
 
                 - ttl, rdata...
 
@@ -120,9 +120,9 @@ class Update(dns.message.Message):
         """Delete records.  The first argument is always a name.  The other
         arguments can be:
 
-               - I{nothing}
-                
-               - rdataset...
+                - I{nothing}
+
+                - rdataset...
 
                 - rdata...
 
@@ -162,8 +162,8 @@ class Update(dns.message.Message):
     def replace(self, name, *args):
         """Replace records.  The first argument is always a name.  The other
         arguments can be:
-                
-               - rdataset...
+
+                - rdataset...
 
                 - ttl, rdata...
 
@@ -171,7 +171,7 @@ class Update(dns.message.Message):
 
         Note that if you want to replace the entire node, you should do
         a delete of the name followed by one or more calls to add."""
-        
+
         self._add(True, self.authority, name, *args)
 
     def present(self, name, *args):
@@ -179,13 +179,13 @@ class Update(dns.message.Message):
         or specific rdataset) exists as a prerequisite to the
         execution of the update.  The first argument is always a name.
         The other arguments can be:
-                
-               - rdataset...
+
+                - rdataset...
 
                 - rdata...
 
                 - rdtype, string..."""
-        
+
         if isinstance(name, (str, unicode)):
             name = dns.name.from_text(name, None)
         if len(args) == 0:
@@ -196,7 +196,7 @@ class Update(dns.message.Message):
         elif isinstance(args[0], dns.rdataset.Rdataset) or \
              isinstance(args[0], dns.rdata.Rdata) or \
              len(args) > 1:
-            if len(args) > 1:
+            if not isinstance(args[0], dns.rdata.Rdataset):
                 # Add a 0 TTL
                 args = list(args)
                 args.insert(0, 0)
@@ -218,7 +218,7 @@ class Update(dns.message.Message):
             name = dns.name.from_text(name, None)
         if rdtype is None:
             rrset = self.find_rrset(self.answer, name,
-                                    dns.rdataclass.NONE, dns.rdatatype.ANY, 
+                                    dns.rdataclass.NONE, dns.rdatatype.ANY,
                                     dns.rdatatype.NONE, None,
                                     True, True)
         else: