[Zodb-checkins] CVS: StandaloneZODB/ZODB - FileStorage.py:1.65

Jeremy Hylton [email protected]
Wed, 12 Sep 2001 17:36:17 -0400

Update of /cvs-repository/StandaloneZODB/ZODB
In directory cvs.zope.org:/tmp/cvs-serv31667

Modified Files:
Log Message:
Improve robustness of _restore_index()

Handle two new failure conditions by ignoring the index and

    - corrupted pickle in .index file
    - no value for 'pos' in pickle (used to call long(None))

=== StandaloneZODB/ZODB/FileStorage.py 1.64 => 1.65 ===
-        info=p.load()
+        try:
+            info=p.load()
+        except:
+            exc, err, tb = sys.exc_info()
+            warn("Failed to load database index: %s: %s" %
+                 (exc, err))
+            return None
         index=info.get('index', None)
-        pos=long(info.get('pos', None))
+        pos=info.get('pos', None)
         oid=info.get('oid', None)
         vindex=info.get('vindex', None)
         if index is None or pos is None or oid is None or vindex is None:
             return None
+        pos = long(pos)
         tid=self._sane(index, pos)
         if not tid: return None