Commit 64855162 authored by Jeremy Hylton's avatar Jeremy Hylton

Handle extension methods explicitly rather than be getattr hack.

parent be6fc1f9
......@@ -416,11 +416,16 @@ class ClientStorage:
stub = self.StorageServerStubClass(conn)
self._oids = []
self._info.update(stub.get_info())
self._handle_extensions()
self.verify_cache(stub)
if not conn.is_async():
log2(INFO, "Waiting for cache verification to finish")
self._wait_sync()
def _handle_extensions(self):
for name in self.getExtensionMethods():
setattr(self, name, self._server.extensionMethod(name))
def set_server_addr(self, addr):
# Normalize server address and convert to string
if isinstance(addr, types.StringType):
......@@ -548,7 +553,7 @@ class ClientStorage:
Dictionary values should be None; this will be a handy place
for extra marshalling information, should we need it
"""
return self._info['extensionMethods']
return self._info.get('extensionMethods', {})
def supportsUndo(self):
"""Storage API: return whether we support undo."""
......@@ -619,12 +624,6 @@ class ClientStorage:
"""
return self._server.history(oid, version, length)
def __getattr__(self, name):
if self.getExtensionMethods().has_key(name):
return self._server.extensionMethod(name)
else:
raise AttributeError(name)
def loadSerial(self, oid, serial):
"""Storage API: load a historical revision of an object."""
return self._server.loadSerial(oid, serial)
......@@ -757,7 +756,6 @@ class ClientStorage:
self._tbuf.clear()
self._seriald.clear()
del self._serials[:]
self._tbuf.clear()
def end_transaction(self):
"""Internal helper to end a transaction."""
......
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