From: bastiak Date: Thu, 20 Feb 2014 12:41:15 +0000 (+0100) Subject: Allows to copy dns.name.Name objects X-Git-Tag: v1.12.0~20^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=433ee1de939442469ae2514f3c3e68c3b50e59a9;p=thirdparty%2Fdnspython.git Allows to copy dns.name.Name objects --- diff --git a/dns/name.py b/dns/name.py index 293ab951..5f8f213d 100644 --- a/dns/name.py +++ b/dns/name.py @@ -24,6 +24,7 @@ import cStringIO import struct import sys +import copy if sys.hexversion >= 0x02030000: import encodings.idna @@ -149,6 +150,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