Commit 84289867 authored by Jim Fulton's avatar Jim Fulton

Use issubclass rather than interface introspection to decide if an

object is a blob.  YAGNI support for multiple blob implementations --
at least for now.
parent f3841bd1
......@@ -29,7 +29,8 @@ from persistent import PickleCache
# interfaces
from persistent.interfaces import IPersistentDataManager
from ZODB.interfaces import IConnection
from ZODB.interfaces import IBlob, IBlobStorage
from ZODB.interfaces import IBlobStorage
from ZODB.blob import Blob
from transaction.interfaces import ISavepointDataManager
from transaction.interfaces import IDataManagerSavepoint
from transaction.interfaces import ISynchronizer
......@@ -607,13 +608,7 @@ class Connection(ExportImport, object):
self._modified.append(oid)
p = writer.serialize(obj) # This calls __getstate__ of 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 isinstance(obj, Blob):
if not IBlobStorage.providedBy(self._storage):
raise Unsupported(
"Storing Blobs in %s is not supported." %
......@@ -862,10 +857,9 @@ class Connection(ExportImport, object):
obj._p_serial = serial
# Blob support
providedBy = getattr(obj, '__providedBy__', None)
if providedBy is not None and IBlob in providedBy:
if isinstance(obj, Blob):
obj._p_blob_uncommitted = None
obj._p_blob_data = self._storage.loadBlob(obj._p_oid, serial)
obj._p_blob_committed = self._storage.loadBlob(obj._p_oid, serial)
def _load_before_or_conflict(self, obj):
"""Load non-current state for obj or raise ReadConflictError."""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment