summaryrefslogtreecommitdiff
path: root/dns/rrset.py
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2020-09-03 07:46:53 -0700
committerBob Halley <halley@dnspython.org>2020-09-03 07:46:53 -0700
commit78362aa6b9bce8f0942577c72773cb36c5050b92 (patch)
tree180f8147ec43693d0e84852f762b4783e3741860 /dns/rrset.py
parent1f1888d35b820f67f3bb9262427e8b64f44d62f8 (diff)
downloaddnspython-full_match.tar.gz
fix rrset match signature problemsfull_match
Diffstat (limited to 'dns/rrset.py')
-rw-r--r--dns/rrset.py29
1 files changed, 22 insertions, 7 deletions
diff --git a/dns/rrset.py b/dns/rrset.py
index adfcad9..a71d457 100644
--- a/dns/rrset.py
+++ b/dns/rrset.py
@@ -76,22 +76,37 @@ class RRset(dns.rdataset.Rdataset):
return False
return super().__eq__(other)
- # pylint: disable=arguments-differ
+ def match(self, *args, **kwargs):
+ """Does this rrset match the specified attributes?
+
+ Behaves as :py:func:`full_match()` if the first argument is a
+ ``dns.name.Name``, and as :py:func:`dns.rdataset.Rdataset.match()`
+ otherwise.
- def match(self, name, rdclass, rdtype, covers,
- deleting=None):
- """Returns ``True`` if this rrset matches the specified class, type,
- covers, and deletion state.
+ (This behavior fixes a design mistake where the signature of this
+ method became incompatible with that of its superclass. The fix
+ makes RRsets matchable as Rdatasets while preserving backwards
+ compatibility.)
"""
+ if isinstance(args[0], dns.name.Name):
+ return self.full_match(*args, **kwargs)
+ else:
+ return super().match(*args, **kwargs)
+ def full_match(self, name, rdclass, rdtype, covers,
+ deleting=None):
+ """Returns ``True`` if this rrset matches the specified name, class,
+ type, covers, and deletion state.
+ """
if not super().match(rdclass, rdtype, covers):
return False
if self.name != name or self.deleting != deleting:
return False
return True
- def to_text(self, origin=None, relativize=True,
- **kw):
+ # pylint: disable=arguments-differ
+
+ def to_text(self, origin=None, relativize=True, **kw):
"""Convert the RRset into DNS zone file format.
See ``dns.name.Name.choose_relativity`` for more information