Commit f51bf546 authored by Jim Fulton's avatar Jim Fulton

We want interfaces provided by the client storage to reflect

interfaces provided by the served storage on the storage server.

The old way this was done was to copy all of the interface
declarations from the served storage. This has 2 problems:

1. Not all interfaces copied were actually provided by the client
storage. Just because a remote storage provides an interface, doesn't
mean the client storage can, especially if the method (or attribute)
isn't supported by the ZEO protocol.

2. Older clients could get import errors while trying to import copies
interfaces.

Now, we only declare from a known set of interfaces defined on the client.
parent 1aecb013
...@@ -559,14 +559,15 @@ class ClientStorage(object): ...@@ -559,14 +559,15 @@ class ClientStorage(object):
self._handle_extensions() self._handle_extensions()
# Decorate ClientStorage with all interfaces that the backend storage for iface in (
# supports. ZODB.interfaces.IStorageRestoreable,
remote_interfaces = [] ZODB.interfaces.IStorageIteration,
for module_name, interface_name in self._info['interfaces']: ZODB.interfaces.IStorageUndoable,
module = __import__(module_name, globals(), locals(), [interface_name]) ZODB.interfaces.IStorageCurrentRecordIteration,
interface = getattr(module, interface_name) ZODB.interfaces.IBlobStorage,
remote_interfaces.append(interface) ):
zope.interface.directlyProvides(self, remote_interfaces) if (iface.__module__, iface.__name__) in self._info.get('interfaces', ()):
zope.interface.alsoProvides(self, iface)
def _handle_extensions(self): def _handle_extensions(self):
for name in self.getExtensionMethods().keys(): for name in self.getExtensionMethods().keys():
......
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