Commit 48874b2e authored by Jeremy Hylton's avatar Jeremy Hylton

Replace more KeyErrors with POSKeyErrors

parent e7e18db7
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
# may have a back pointer to a version record or to a non-version # may have a back pointer to a version record or to a non-version
# record. # record.
# #
__version__='$Revision: 1.82 $'[11:-2] __version__='$Revision: 1.83 $'[11:-2]
import struct, time, os, string, base64, sys import struct, time, os, string, base64, sys
from struct import pack, unpack from struct import pack, unpack
...@@ -578,18 +578,19 @@ class FileStorage(BaseStorage.BaseStorage, ...@@ -578,18 +578,19 @@ class FileStorage(BaseStorage.BaseStorage,
def load(self, oid, version, _stuff=None): def load(self, oid, version, _stuff=None):
self._lock_acquire() self._lock_acquire()
try: return self._load(oid, version, self._index, self._file) try:
finally: self._lock_release() return self._load(oid, version, self._index, self._file)
finally:
self._lock_release()
def loadSerial(self, oid, serial): def loadSerial(self, oid, serial):
self._lock_acquire() self._lock_acquire()
try: try:
_index=self._index
file=self._file file=self._file
seek=file.seek seek=file.seek
read=file.read read=file.read
try: try:
pos=_index[oid] pos = self._index[oid]
except KeyError: except KeyError:
raise POSKeyError(oid) raise POSKeyError(oid)
while 1: while 1:
...@@ -619,7 +620,10 @@ class FileStorage(BaseStorage.BaseStorage, ...@@ -619,7 +620,10 @@ class FileStorage(BaseStorage.BaseStorage,
def modifiedInVersion(self, oid): def modifiedInVersion(self, oid):
self._lock_acquire() self._lock_acquire()
try: try:
pos=self._index[oid] try:
pos = self._index[oid]
except KeyError:
raise POSKeyError(oid)
file=self._file file=self._file
seek=file.seek seek=file.seek
seek(pos) seek(pos)
......
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