+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
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.
argument is the section to add to. The third argument
is always a name. The other arguments can be:
- - rdataset...
+ - rdataset...
- ttl, rdata...
"""Add records. The first argument is always a name. The other
arguments can be:
- - rdataset...
+ - rdataset...
- ttl, rdata...
"""Delete records. The first argument is always a name. The other
arguments can be:
- - I{nothing}
-
- - rdataset...
+ - I{nothing}
+
+ - rdataset...
- rdata...
def replace(self, name, *args):
"""Replace records. The first argument is always a name. The other
arguments can be:
-
- - rdataset...
+
+ - rdataset...
- ttl, rdata...
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):
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:
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)
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: