diff options
author | Bob Halley <halley@play-bow.org> | 2014-03-14 06:51:09 -0700 |
---|---|---|
committer | Bob Halley <halley@play-bow.org> | 2014-03-14 06:51:09 -0700 |
commit | 01e5a49816c1c6ffc9cf0a4676662193649a9380 (patch) | |
tree | 0e4509d40a46085dd17a5e5e6cb9d778cdb78ee1 | |
parent | f80e6392aeb863adefe283d8cc7066d9d8dc3d09 (diff) | |
parent | 433ee1de939442469ae2514f3c3e68c3b50e59a9 (diff) | |
download | dnspython-01e5a49816c1c6ffc9cf0a4676662193649a9380.tar.gz |
Merge pull request #57 from bastiak/master
Allows to copy dns.name.Name objects
-rw-r--r-- | dns/name.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/dns/name.py b/dns/name.py index 293ab95..5f8f213 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 |