[Checkins] SVN: zodbupdate/trunk/src/zodbupdate/serialize.py So actually the metaclass solution is the correct one for interfaces.
Sylvain Viollon
sylvain at infrae.com
Tue Jun 8 12:20:21 EDT 2010
Log message for revision 113294:
So actually the metaclass solution is the correct one for interfaces.
Changed:
U zodbupdate/trunk/src/zodbupdate/serialize.py
-=-
Modified: zodbupdate/trunk/src/zodbupdate/serialize.py
===================================================================
--- zodbupdate/trunk/src/zodbupdate/serialize.py 2010-06-08 16:02:03 UTC (rev 113293)
+++ zodbupdate/trunk/src/zodbupdate/serialize.py 2010-06-08 16:20:20 UTC (rev 113294)
@@ -36,13 +36,8 @@
raise StopIteration
-class ZODBBroken(Broken):
- """Extend ZODB Broken to work with broken objects that doesn't
- have any __Broken_newargs__ sets (which happens if their __new__
- method is not called).
- """
+class IterableClass(type):
- @classmethod
def __iter__(cls):
"""Define a empty iterator to fix unpickling of missing
Interfaces that have been used to do alsoProvides on a another
@@ -50,6 +45,14 @@
"""
return NullIterator()
+
+class ZODBBroken(Broken):
+ """Extend ZODB Broken to work with broken objects that doesn't
+ have any __Broken_newargs__ sets (which happens if their __new__
+ method is not called).
+ """
+ __metaclass__ = IterableClass
+
def __reduce__(self):
"""We pickle broken objects in hope of being able to fix them later.
"""
More information about the checkins
mailing list