[Zodb-checkins] SVN: ZODB/trunk/src/ZEO/ClientStorage.py We want interfaces provided by the client storage to reflect
Jim Fulton
jim at zope.com
Tue Oct 21 13:07:56 EDT 2008
Log message for revision 92434:
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.
Changed:
U ZODB/trunk/src/ZEO/ClientStorage.py
-=-
Modified: ZODB/trunk/src/ZEO/ClientStorage.py
===================================================================
--- ZODB/trunk/src/ZEO/ClientStorage.py 2008-10-21 16:22:47 UTC (rev 92433)
+++ ZODB/trunk/src/ZEO/ClientStorage.py 2008-10-21 17:07:55 UTC (rev 92434)
@@ -559,14 +559,15 @@
self._handle_extensions()
- # Decorate ClientStorage with all interfaces that the backend storage
- # supports.
- remote_interfaces = []
- for module_name, interface_name in self._info['interfaces']:
- module = __import__(module_name, globals(), locals(), [interface_name])
- interface = getattr(module, interface_name)
- remote_interfaces.append(interface)
- zope.interface.directlyProvides(self, remote_interfaces)
+ for iface in (
+ ZODB.interfaces.IStorageRestoreable,
+ ZODB.interfaces.IStorageIteration,
+ ZODB.interfaces.IStorageUndoable,
+ ZODB.interfaces.IStorageCurrentRecordIteration,
+ ZODB.interfaces.IBlobStorage,
+ ):
+ if (iface.__module__, iface.__name__) in self._info.get('interfaces', ()):
+ zope.interface.alsoProvides(self, iface)
def _handle_extensions(self):
for name in self.getExtensionMethods().keys():
More information about the Zodb-checkins
mailing list