summaryrefslogtreecommitdiff
path: root/dns/rdtypes/dsbase.py
diff options
context:
space:
mode:
authorBrian Wellington <bwelling@xbill.org>2020-06-01 11:32:03 -0700
committerBrian Wellington <bwelling@xbill.org>2020-06-01 11:32:03 -0700
commitc6c0041169f4888ffd96e7ca3d69c8ed351b8cb0 (patch)
tree5684f461ae86c698cbefcdf0b8213f7074d19c81 /dns/rdtypes/dsbase.py
parent8b687180391afc37c59eb57ae0fc5a77a2d894cc (diff)
downloaddnspython-c6c0041169f4888ffd96e7ca3d69c8ed351b8cb0.tar.gz
Improvements to dns.rdata.to_wire().
This does two things. 1) Makes the file parameter optional, removing the requirement that callers create an io.BytesIO object if all they want is the bytes. This is done by renaming all of the rdata subclass to_wire() methods to _to_wire(), and making dns.rdata.to_wire() create the io.BytesIO internally if needed, and then delegate to the subclass. 2) Add canonicalize=False parameter, allowing code reuse for conversion to wire format and conversion to hashable format. This also removes all of the rdata subclass to_digestable routines that are no longer needed, as dns.rdata.to_digestable will work for all rdata types.
Diffstat (limited to 'dns/rdtypes/dsbase.py')
-rw-r--r--dns/rdtypes/dsbase.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/dns/rdtypes/dsbase.py b/dns/rdtypes/dsbase.py
index 8da007b..4f082c7 100644
--- a/dns/rdtypes/dsbase.py
+++ b/dns/rdtypes/dsbase.py
@@ -61,7 +61,7 @@ class DSBase(dns.rdata.Rdata):
return cls(rdclass, rdtype, key_tag, algorithm, digest_type,
digest)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
header = struct.pack("!HBB", self.key_tag, self.algorithm,
self.digest_type)
file.write(header)