On 19/07/2012 01:05, Bob Halley wrote:
Hi Bob,
>>>>>> z.get_deepest_match(dns.name.from_text('z3'))
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in <module>
>>> File "/Library/Python/2.7/site-packages/dns/namedict.py", line 58, in
>>> get_deepest_match
>>> v = self[dns.name.empty]
>>> KeyError: <DNS name @>
>>>
>>> Is this a bug?
>
> It may be a bit surprising but it's not a bug per se. The namedict
> doesn't come with an entry for dns.name.root or dns.name.empty. So, if
> you want get_deepest_match() to match something and not raise KeyError,
> you must have an entry for the root of the tree (either dns.name.root if
> you're working with absolute names, or dns.name.empty if you're working
> with relativized names).
Okay, thanks for the explanation. In fact, I did work around it by
creating an entry for dns.name.empty in my namedict. So my solution was
along the right track.
The name of the function is indeed unfortunate, as I usually expect get_
functions to return None, not raise exceptions. That's why I thought it
was a bug.
Anand
_______________________________________________
dnspython-users mailing list
[email protected]
http://howl.play-bow.org/mailman/listinfo/dnspython-users