[Zope3-checkins] SVN: Zope3/branches/3.2/ Ensured that
'zope.interface.ImplementedBy' is picklable.
Tres Seaver
tseaver at palladion.com
Wed Jun 6 05:27:09 EDT 2007
Log message for revision 76390:
Ensured that 'zope.interface.ImplementedBy' is picklable.
o Fixes obscure ZClass test bug in Zope 2.9).
Changed:
U Zope3/branches/3.2/doc/CHANGES.txt
U Zope3/branches/3.2/src/zope/interface/declarations.py
U Zope3/branches/3.2/src/zope/interface/tests/test_declarations.py
-=-
Modified: Zope3/branches/3.2/doc/CHANGES.txt
===================================================================
--- Zope3/branches/3.2/doc/CHANGES.txt 2007-06-06 09:23:18 UTC (rev 76389)
+++ Zope3/branches/3.2/doc/CHANGES.txt 2007-06-06 09:27:08 UTC (rev 76390)
@@ -10,6 +10,9 @@
Bug fixes
+ - Ensured that 'zope.interface.ImplementedBy' is picklable
+ (fixes obscure ZClass test bug in Zope 2.9).
+
- #98111: z.a.form.browser.itemswidget.MultiDataHelper._toFieldValue()
context._type attribute was being ignored when the result was an empty
collection.
Modified: Zope3/branches/3.2/src/zope/interface/declarations.py
===================================================================
--- Zope3/branches/3.2/src/zope/interface/declarations.py 2007-06-06 09:23:18 UTC (rev 76389)
+++ Zope3/branches/3.2/src/zope/interface/declarations.py 2007-06-06 09:27:08 UTC (rev 76390)
@@ -271,6 +271,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/3.2/src/zope/interface/tests/test_declarations.py
===================================================================
--- Zope3/branches/3.2/src/zope/interface/tests/test_declarations.py 2007-06-06 09:23:18 UTC (rev 76389)
+++ Zope3/branches/3.2/src/zope/interface/tests/test_declarations.py 2007-06-06 09:27:08 UTC (rev 76390)
@@ -298,6 +298,12 @@
>>> import zope.interface.declarations
>>> impl = zope.interface.declarations.Implements(I1, I2)
+ Verify that we can pickle it:
+
+ >>> from cPickle import dumps, loads
+ >>> dilly = dumps(impl)
+ >>> new_impl = loads(dilly)
+
Now, we'll emulate a declaration for a built-in type by putting
it in BuiltinImplementationSpecifications:
More information about the Zope3-Checkins
mailing list