diff options
| author | Bob Halley <halley@nominum.com> | 2009-11-13 03:39:14 +0900 |
|---|---|---|
| committer | Bob Halley <halley@nominum.com> | 2009-11-13 03:39:14 +0900 |
| commit | ff64ce87300903a843ab13a2b4ff1ab6633371ba (patch) | |
| tree | 339ee8130c6983d321c20f10b54eec86b6fd8354 | |
| parent | 81e55e3c1d6524ec955d070bc2ebff009b366b40 (diff) | |
| download | dnspython-ff64ce87300903a843ab13a2b4ff1ab6633371ba.tar.gz | |
present() did not add a zero TTL if its argument was a single rdata
| -rw-r--r-- | ChangeLog | 7 | ||||
| -rw-r--r-- | dns/update.py | 28 |
2 files changed, 21 insertions, 14 deletions
@@ -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 diff --git a/dns/update.py b/dns/update.py index f54a51b..5bd289f 100644 --- a/dns/update.py +++ b/dns/update.py @@ -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: |
