[Zodb-checkins] SVN: ZODB/branches/blob-merge-branch/src/ZODB/Connection.py Fix final failing test in the persistentclass.txt file.

Michael Kerrin michael.kerrin at openapp.biz
Mon Dec 5 14:14:12 EST 2005


Log message for revision 40554:
  Fix final failing test in the persistentclass.txt file.
  

Changed:
  U   ZODB/branches/blob-merge-branch/src/ZODB/Connection.py

-=-
Modified: ZODB/branches/blob-merge-branch/src/ZODB/Connection.py
===================================================================
--- ZODB/branches/blob-merge-branch/src/ZODB/Connection.py	2005-12-05 18:43:12 UTC (rev 40553)
+++ ZODB/branches/blob-merge-branch/src/ZODB/Connection.py	2005-12-05 19:14:12 UTC (rev 40554)
@@ -558,7 +558,13 @@
                 self._modified.append(oid)
             p = writer.serialize(obj)  # This calls __getstate__ of obj
 
-            if IBlob.providedBy(obj):
+            # This is a workaround to calling IBlob.proivdedBy(obj). Calling
+            # Interface.providedBy on a object to be stored can invertible
+            # set the '__providedBy__' and '__implemented__' attributes on the
+            # object. This interferes the storing of the object by requesting
+            # that the values of these objects should be stored with the ZODB.
+            providedBy = getattr(obj, '__providedBy__', None)
+            if providedBy is not None and IBlob in providedBy:
                 if not IBlobStorage.providedBy(self._storage):
                     raise Unsupported(
                         "Storing Blobs in %s is not supported." % 
@@ -811,7 +817,8 @@
         obj._p_serial = serial
 
         # Blob support
-        if IBlob.providedBy(obj):
+        providedBy = getattr(obj, '__providedBy__', None)
+        if providedBy is not None and IBlob in providedBy:
             obj._p_blob_uncommitted = None
             obj._p_blob_data = \
                     self._storage.loadBlob(obj._p_oid, serial, self._version)



More information about the Zodb-checkins mailing list