[Checkins] SVN: ZODB/trunk/src/ Fix for bug #184054: MappingStorage used to raise a KeyError during `load`

Christian Theune ct at gocept.com
Sat May 3 04:39:03 EDT 2008


Log message for revision 86153:
  Fix for bug #184054: MappingStorage used to raise a KeyError during `load`
  instead of a POSKeyError.
  

Changed:
  U   ZODB/trunk/src/CHANGES.txt
  U   ZODB/trunk/src/ZODB/MappingStorage.py
  U   ZODB/trunk/src/ZODB/tests/testConnection.py

-=-
Modified: ZODB/trunk/src/CHANGES.txt
===================================================================
--- ZODB/trunk/src/CHANGES.txt	2008-05-03 08:26:02 UTC (rev 86152)
+++ ZODB/trunk/src/CHANGES.txt	2008-05-03 08:39:03 UTC (rev 86153)
@@ -37,6 +37,9 @@
 Bugs Fixed
 ----------
 
+- Fix for bug #184054: MappingStorage used to raise a KeyError during `load`
+  instead of a POSKeyError.
+
 - Fixed bug in Connection.TmpStore: load() would not defer to the backend
   storage for loading blobs.
 

Modified: ZODB/trunk/src/ZODB/MappingStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/MappingStorage.py	2008-05-03 08:26:02 UTC (rev 86152)
+++ ZODB/trunk/src/ZODB/MappingStorage.py	2008-05-03 08:39:03 UTC (rev 86153)
@@ -58,8 +58,11 @@
     def load(self, oid, version):
         self._lock_acquire()
         try:
-            p = self._index[oid]
-            return p[8:], p[:8] # pickle, serial
+            try:
+                p = self._index[oid]
+                return p[8:], p[:8] # pickle, serial
+            except KeyError:
+                raise POSException.POSKeyError(oid)
         finally:
             self._lock_release()
 

Modified: ZODB/trunk/src/ZODB/tests/testConnection.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/testConnection.py	2008-05-03 08:26:02 UTC (rev 86152)
+++ ZODB/trunk/src/ZODB/tests/testConnection.py	2008-05-03 08:39:03 UTC (rev 86153)
@@ -209,12 +209,12 @@
         >>> obj._p_state
         0
 
-        A request for an object that doesn't exist will raise a KeyError.
+        A request for an object that doesn't exist will raise a POSKeyError.
 
         >>> cn.get(p64(1))
         Traceback (most recent call last):
           ...
-        KeyError: '\x00\x00\x00\x00\x00\x00\x00\x01'
+        POSKeyError: 0x01
         """
 
     def test_close(self):



More information about the Checkins mailing list