]> 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)
committerBob Halley <halley@dnspython.org>
Thu, 26 Feb 2015 14:04:26 +0000 (06:04 -0800)
dns/name.py

index 55c3fde0b161c50eaf30e7a3bc1961eae3d6ced2..9e17cddfe00d7a93ed9e1ec98d348725ea54a4ba 100644 (file)
@@ -152,6 +152,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