summaryrefslogtreecommitdiff
path: root/dns
diff options
context:
space:
mode:
authorkimbo <kimballleavitt@gmail.com>2021-02-16 15:21:13 -0700
committerkimbo <kimballleavitt@gmail.com>2021-02-16 15:21:13 -0700
commit7d4d4715b5ebbe01cc4e4a0da662116263d747b1 (patch)
tree1d24e0c8e817d5e6629391db4b44d6ad7f7c1126 /dns
parenta9dc095ad49d1e1a11197af31b188bb7c50d85de (diff)
downloaddnspython-7d4d4715b5ebbe01cc4e4a0da662116263d747b1.tar.gz
make `name in zone` consistent with `zone[name]`
specifically, allow name to be a str, and raise a KeyError if name cannot be converted into a dns.name.Name
Diffstat (limited to 'dns')
-rw-r--r--dns/zone.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/dns/zone.py b/dns/zone.py
index c9c1c20..ac95763 100644
--- a/dns/zone.py
+++ b/dns/zone.py
@@ -162,8 +162,9 @@ class Zone(dns.transaction.TransactionManager):
key = self._validate_name(key)
return self.nodes.get(key)
- def __contains__(self, other):
- return other in self.nodes
+ def __contains__(self, key):
+ key = self._validate_name(key)
+ return key in self.nodes
def find_node(self, name, create=False):
"""Find a node in the zone, possibly creating it.