Commit 34ac0dec authored by Jeremy Hylton's avatar Jeremy Hylton

Replace explicit type() comparisons with isinstance() calls

parent 61e2f3b1
...@@ -186,7 +186,7 @@ ...@@ -186,7 +186,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.70 $'[11:-2] __version__='$Revision: 1.71 $'[11:-2]
import struct, time, os, bpthread, string, base64, sys import struct, time, os, bpthread, string, base64, sys
from struct import pack, unpack from struct import pack, unpack
...@@ -465,9 +465,8 @@ class FileStorage(BaseStorage.BaseStorage, ...@@ -465,9 +465,8 @@ class FileStorage(BaseStorage.BaseStorage,
def commitVersion(self, src, dest, transaction, abort=None): def commitVersion(self, src, dest, transaction, abort=None):
# We are going to commit by simply storing back pointers. # We are going to commit by simply storing back pointers.
if (not src or if not (src and isinstance(src, StringType)
type(src) is not StringType or type(dest) is not StringType and isinstance(dest, StringType)):
):
raise POSException.VersionCommitError('Invalid source version') raise POSException.VersionCommitError('Invalid source version')
if src == dest: if src == dest:
...@@ -2012,7 +2011,8 @@ class FileIterator(Iterator): ...@@ -2012,7 +2011,8 @@ class FileIterator(Iterator):
_ltid=z64 _ltid=z64
def __init__(self, file): def __init__(self, file):
if type(file) is type(''): file=open(file, 'rb') if isinstance(file, StringType):
file=open(file, 'rb')
self._file=file self._file=file
if file.read(4) != packed_version: raise FileStorageFormatError, name if file.read(4) != packed_version: raise FileStorageFormatError, name
file.seek(0,2) file.seek(0,2)
......
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