[Checkins] SVN: gocept.zeoraid/trunk/src/gocept/zeoraid/storage.py removed a spurious raise stmt, made two methods more robust

Thomas Lotze tl at gocept.com
Thu Feb 21 08:56:37 EST 2008


Log message for revision 84112:
  removed a spurious raise stmt, made two methods more robust

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-02-21 13:31:10 UTC (rev 84111)
+++ gocept.zeoraid/trunk/src/gocept/zeoraid/storage.py	2008-02-21 13:56:37 UTC (rev 84112)
@@ -168,7 +168,10 @@
 
     def getSize(self):
         """An approximate size of the database, in bytes."""
-        return self._apply_single_storage('getSize')
+        try:
+            return self._apply_single_storage('getSize')
+        except gocept.zeoraid.interfaces.RAIDError:
+            return 0
 
     def history(self, oid, version='', size=1):
         """Return a sequence of history information dictionaries."""
@@ -187,7 +190,10 @@
 
     def __len__(self):
         """The approximate number of objects in the storage."""
-        return self._apply_single_storage('__len__')
+        try:
+            return self._apply_single_storage('__len__')
+        except gocept.zeoraid.interfaces.RAIDError:
+            return 0
 
     def load(self, oid, version=''):
         """Load data for an object id and version."""
@@ -523,7 +529,6 @@
             # Handle StorageErrors first, otherwise they would be swallowed
             # when POSErrors are.
             reliable = False
-            raise
         except (ZODB.POSException.POSError,
                 transaction.interfaces.TransactionError), e:
             # These exceptions are valid answers from the storage. They don't



More information about the Checkins mailing list