[Checkins] SVN: gocept.zeoraid/trunk/src/gocept/zeoraid/storage.py
cleaned up the __apply_storage code
Thomas Lotze
tl at gocept.com
Wed Jan 16 05:55:37 EST 2008
Log message for revision 82920:
cleaned up the __apply_storage code
Changed:
U gocept.zeoraid/trunk/src/gocept/zeoraid/storage.py
-=-
Modified: gocept.zeoraid/trunk/src/gocept/zeoraid/storage.py
===================================================================
--- gocept.zeoraid/trunk/src/gocept/zeoraid/storage.py 2008-01-16 10:43:26 UTC (rev 82919)
+++ gocept.zeoraid/trunk/src/gocept/zeoraid/storage.py 2008-01-16 10:55:36 UTC (rev 82920)
@@ -486,28 +486,27 @@
# XXX storage might be degraded by now, need to check.
storage = self.storages[name]
method = getattr(storage, method_name)
+ reliable = True
+ result = None
try:
result = method(*args, **kw)
except ZODB.POSException.StorageError:
# Handle StorageErrors first, otherwise they would be swallowed
# when POSErrors are.
- self._degrade_storage(name)
- return (False, None)
+ reliable = False
except (ZODB.POSException.POSError,
transaction.interfaces.TransactionError), e:
# These exceptions are valid answers from the storage. They don't
# indicate storage failure.
raise
except Exception:
- # We have no result.
- self._degrade_storage(name)
- return (False, None)
+ reliable = False
if expect_connected and not storage.is_connected():
- # We cannot rely on the result.
+ reliable = False
+
+ if not reliable:
self._degrade_storage(name)
- return (False, None)
- # Everything went fine.
- return (True, result)
+ return (reliable, result)
@ensure_open_storage
def _apply_single_storage(self, method_name, args=(), kw={}):
@@ -518,6 +517,7 @@
name, method_name, args, kw)
if reliable:
return result
+
# We could not determine a result from any storage.
raise gocept.zeoraid.interfaces.RAIDError("RAID storage is failed.")
More information about the Checkins
mailing list