From: Bob Halley Date: Fri, 21 Aug 2020 17:12:17 +0000 (-0700) Subject: add as_rdataclass() and as_rdatatype(), and use them in rdata constructor X-Git-Tag: v2.1.0rc1~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=52b2a74005faf54e1e80e0e196341cc71c501c3b;p=thirdparty%2Fdnspython.git add as_rdataclass() and as_rdatatype(), and use them in rdata constructor --- diff --git a/dns/rdata.py b/dns/rdata.py index a5d3a66a..2dec6e6e 100644 --- a/dns/rdata.py +++ b/dns/rdata.py @@ -111,8 +111,8 @@ class Rdata: *rdtype*, an ``int`` is the rdatatype of the Rdata. """ - self.rdclass = rdclass - self.rdtype = rdtype + self.rdclass = self.as_rdataclass(rdclass) + self.rdtype = self.as_rdatatype(rdtype) self.rdcomment = None def _get_all_slots(self): @@ -337,6 +337,12 @@ class Rdata: # doesn't do any additional checking. return value + def as_rdataclass(self, value): + return dns.rdataclass.RdataClass.make(value) + + def as_rdatatype(self, value): + return dns.rdatatype.RdataType.make(value) + class GenericRdata(Rdata):