]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Use decorator syntax for properties.
authorBrian Wellington <bwelling@xbill.org>
Fri, 3 Apr 2020 18:07:07 +0000 (11:07 -0700)
committerBrian Wellington <bwelling@xbill.org>
Fri, 3 Apr 2020 18:07:07 +0000 (11:07 -0700)
dns/resolver.py

index 889303799f39be022d9f8e054d24b8bfda15628d..6e4fe0a473597274ab795af40a3ec331d0400631 100644 (file)
@@ -74,7 +74,9 @@ class NXDOMAIN(dns.exception.DNSException):
         qnames = ', '.join(map(str, qnames))
         return "{}: {}".format(msg, qnames)
 
+    @property
     def canonical_name(self):
+        """Return the unresolved canonical name."""
         if not 'qnames' in self.kwargs:
             raise TypeError("parametrized exception required")
         IN = dns.rdataclass.IN
@@ -89,8 +91,6 @@ class NXDOMAIN(dns.exception.DNSException):
             if cname is not None:
                 return dns.name.from_text(cname)
         return self.kwargs['qnames'][0]
-    canonical_name = property(canonical_name, doc=(
-        "Return the unresolved canonical name."))
 
     def __add__(self, e_nx):
         """Augment by results from another NXDOMAIN exception."""