[Zodb-checkins] CVS: Packages/ZEO - StorageServer.py:1.28
jeremy@digicool.com
jeremy@digicool.com
Mon, 14 May 2001 15:08:20 -0400 (EDT)
Update of /cvs-repository/Packages/ZEO
In directory korak.digicool.com:/tmp/cvs-serv26537
Modified Files:
StorageServer.py
Log Message:
Fix get_info() so that it copes if the storage doesn't define a
"supportsTransactionalUndo()" method.
XXX untested
XXX This mechanism for feature evolutional doesn't seem right, because
it because a morass of backwards compatibility issues. I'd rather see
the test by one of presence/absence of an attribute or a base class.
--- Updated File StorageServer.py in package Packages/ZEO --
--- StorageServer.py 2001/05/09 18:38:23 1.27
+++ StorageServer.py 2001/05/14 19:08:19 1.28
@@ -315,14 +315,19 @@
def get_info(self):
storage=self.__storage
- return {
+ info = {
'length': len(storage),
'size': storage.getSize(),
'name': storage.getName(),
- 'supportsUndo': storage.supportsUndo(),
- 'supportsVersions': storage.supportsVersions(),
- 'supportsTransactionalUndo': storage.supportsTransactionalUndo(),
}
+ for feature in ('supportsUndo',
+ 'supportsVersions',
+ 'supportsTransactionalUndo',):
+ if hasattr(storage, feature):
+ info[feature] = getattr(storage, feature)()
+ else:
+ info[feature] = 0
+ return info
def get_size_info(self):
storage=self.__storage