[Zope3-checkins] SVN: Zope3/branches/jim-adapter/src/zope/interface/ Made implementation specifications picklable.

Jim Fulton jim at zope.com
Tue Feb 28 15:17:38 EST 2006


Log message for revision 65611:
  Made implementation specifications picklable.
  

Changed:
  U   Zope3/branches/jim-adapter/src/zope/interface/declarations.py
  U   Zope3/branches/jim-adapter/src/zope/interface/tests/test_declarations.py

-=-
Modified: Zope3/branches/jim-adapter/src/zope/interface/declarations.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/interface/declarations.py	2006-02-28 20:14:17 UTC (rev 65610)
+++ Zope3/branches/jim-adapter/src/zope/interface/declarations.py	2006-02-28 20:17:37 UTC (rev 65611)
@@ -256,6 +256,8 @@
     def __repr__(self):
         return '<implementedBy %s>' % (self.__name__)
 
+    def __reduce__(self):
+        return implementedBy, (self.inherit, )
 
 def implementedByFallback(cls):
     """Return the interfaces implemented for a class' instances

Modified: Zope3/branches/jim-adapter/src/zope/interface/tests/test_declarations.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/interface/tests/test_declarations.py	2006-02-28 20:14:17 UTC (rev 65610)
+++ Zope3/branches/jim-adapter/src/zope/interface/tests/test_declarations.py	2006-02-28 20:17:37 UTC (rev 65611)
@@ -389,7 +389,20 @@
 
 """
 
+def test_picklability_of_implements_specifications():
+    """
 
+    Sometimes, we need to pickle implements specs.  We should be able
+    to do so as long as the class is picklable.
+
+    >>> import pickle
+    >>> pickle.loads(pickle.dumps(implementedBy(C))) is implementedBy(C)
+    True
+    
+    
+    """
+
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest(unittest.makeSuite(Test))



More information about the Zope3-Checkins mailing list