[Checkins] SVN: zodbupdate/trunk/src/zodbupdate/serialize.py Fix case of missing interfaces used with alsoProvides.

Sylvain Viollon sylvain at infrae.com
Tue Jun 8 11:31:23 EDT 2010


Log message for revision 113291:
  Fix case of missing interfaces used with alsoProvides.
  

Changed:
  U   zodbupdate/trunk/src/zodbupdate/serialize.py

-=-
Modified: zodbupdate/trunk/src/zodbupdate/serialize.py
===================================================================
--- zodbupdate/trunk/src/zodbupdate/serialize.py	2010-06-08 15:28:50 UTC (rev 113290)
+++ zodbupdate/trunk/src/zodbupdate/serialize.py	2010-06-08 15:31:22 UTC (rev 113291)
@@ -25,12 +25,30 @@
     return isinstance(symb, types.TypeType) and Broken in symb.__mro__
 
 
+class NullIterator:
+    """An empty iterator that doesn't gives any result.
+    """
+
+    def __iter__(self):
+        return self
+
+    def next(self):
+        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).
     """
 
+    def __iter__(self):
+        """Define a empty iterator to fix unpickling of missing
+        Interfaces that have been used to do alsoProvides on a another
+        pickled object.
+        """
+        return NullIterator()
+
     def __reduce__(self):
         """We pickle broken objects in hope of being able to fix them later.
         """



More information about the checkins mailing list