]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Allows to copy dns.name.Name objects
authorbastiak <martin.basti@gmail.com>
Thu, 20 Feb 2014 12:41:15 +0000 (13:41 +0100)
committerBob Halley <halley@dnspython.org>
Sun, 31 Aug 2014 23:20:35 +0000 (16:20 -0700)
dns/name.py

index 3d3b1bed2f288c75fc6da8894c655ec2115d1127..29489982e7a96f7b2bcc182915c8683fe71a5eff 100644 (file)
@@ -25,6 +25,7 @@ import encodings.idna
 import io
 import struct
 import sys
+import copy
 
 import dns.exception
 import dns.util
@@ -156,6 +157,12 @@ class Name(object):
     def __setattr__(self, name, value):
         raise TypeError("object doesn't support attribute assignment")
 
+    def __copy__(self):
+        return Name(self.labels)
+
+    def __deepcopy__(self, memo):
+        return Name(copy.deepcopy(self.labels, memo))
+
     def is_absolute(self):
         """Is the most significant label of this name the root label?
         @rtype: bool