Commit a0ad1157 authored by Jeremy Hylton's avatar Jeremy Hylton

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.
parent fdc560ba
......@@ -83,7 +83,7 @@
#
##############################################################################
__version__ = "$Revision: 1.27 $"[11:-2]
__version__ = "$Revision: 1.28 $"[11:-2]
import asyncore, socket, string, sys, os
from smac import SizedMessageAsyncConnection
......@@ -315,14 +315,19 @@ class ZEOConnection(SizedMessageAsyncConnection):
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
......
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