summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbastiak <martin.basti@gmail.com>2014-02-20 13:41:15 +0100
committerBob Halley <halley@dnspython.org>2014-08-31 16:20:35 -0700
commit7b6ebf77c3ace2bc502a2b142a28a0c2540deece (patch)
tree187adbde217dcfc4ea57a9e738ac1423cf35c70f
parentd68592933a4890e288124fe74c7cb928c08e2206 (diff)
downloaddnspython-7b6ebf77c3ace2bc502a2b142a28a0c2540deece.tar.gz
Allows to copy dns.name.Name objects
-rw-r--r--dns/name.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/dns/name.py b/dns/name.py
index 3d3b1be..2948998 100644
--- a/dns/name.py
+++ b/dns/name.py
@@ -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