On 15 Dec 2010, at 10:04, James Raftery wrote:
> Hi,
>
> The block starting at line 680 of message.py (of release 1.9.2)
> overwrites the record class in delete RRs, where the class would be ANY
> or NONE. I can't process the update request if I can't see the real
> values.
>
> What's the rationale behind this and is there a straightforward way to
> get the actual RR class from a Message object that contains an update
> message / delete RRs?
The rationale is that we're trying to create singleton rrsets, some of which
might have actual rdatas, and you need the true class to get the right rdata
objects created. But fear not, dnspython puts the ANY or NONE class from the
wire form into the "deleting" attribute of the rrset, so you can process the
update.
E.g. given
import dns.message
import dns.rdataclass
import dns.rdatatype
import dns.update
update = dns.update.Update('example.')
update.add('node1', 300, 'A', '10.0.0.1', '10.0.0.2')
update.delete('node2')
update.delete('node3', 'A')
update.delete('node4', 'A', '10.0.0.3', '10.0.0.4')
wire = update.to_wire()
message = dns.message.from_wire(wire)
for rrset in message.authority:
print rrset.name
print "\trdtype", dns.rdatatype.to_text(rrset.rdtype)
print "\trdclass", dns.rdataclass.to_text(rrset.rdclass)
if not rrset.deleting is None:
print "\tdeletion-class", dns.rdataclass.to_text(rrset.deleting)
print
You get this as output:
node1.example.
rdtype A
rdclass IN
node1.example.
rdtype A
rdclass IN
node2.example.
rdtype ANY
rdclass IN
deletion-class ANY
node3.example.
rdtype A
rdclass IN
deletion-class ANY
node4.example.
rdtype A
rdclass IN
deletion-class NONE
node4.example.
rdtype A
rdclass IN
deletion-class NONE
_______________________________________________
dnspython-users mailing list
[email protected]
http://howl.play-bow.org/mailman/listinfo.cgi/dnspython-users