]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Implement the pickle protocol.
authorBob Halley <halley@dnspython.org>
Thu, 26 Feb 2015 14:04:26 +0000 (06:04 -0800)
committerPetr Viktorin <pviktori@redhat.com>
Tue, 26 May 2015 14:45:28 +0000 (16:45 +0200)
dns/name.py

index 44af0985b4a0e2201da08c48fc3210d496146d8b..0c1d4abec596de31729b2cfbd93a546122fa4f6d 100644 (file)
@@ -168,6 +168,13 @@ class Name(object):
     def __deepcopy__(self, memo):
         return Name(copy.deepcopy(self.labels, memo))
 
+    def __getstate__(self):
+        return { 'labels' : self.labels }
+
+    def __setstate__(self, state):
+        super(Name, self).__setattr__('labels', state['labels'])
+        _validate_labels(self.labels)
+
     def is_absolute(self):
         """Is the most significant label of this name the root label?
         @rtype: bool