[Zodb-checkins] CVS: ZODB4/src/zodb/storage - base.py:1.19 file.py:1.14

Barry Warsaw barry@wooz.org
Thu, 13 Mar 2003 17:12:06 -0500


Update of /cvs-repository/ZODB4/src/zodb/storage
In directory cvs.zope.org:/tmp/cvs-serv922/src/zodb/storage

Modified Files:
	base.py file.py 
Log Message:
Eradicate the types module in ZODB (where possible).  Also normalize
on isinstance() instead of type comparisons.


=== ZODB4/src/zodb/storage/base.py 1.18 => 1.19 ===
--- ZODB4/src/zodb/storage/base.py:1.18	Thu Mar 13 17:03:38 2003
+++ ZODB4/src/zodb/storage/base.py	Thu Mar 13 17:11:35 2003
@@ -24,7 +24,6 @@
 import shutil
 import struct
 import threading
-from types import StringTypes
 import logging
 
 # In Python 2.3, we can simply use the bsddb module, but for Python 2.2, we


=== ZODB4/src/zodb/storage/file.py 1.13 => 1.14 ===
--- ZODB4/src/zodb/storage/file.py:1.13	Thu Mar 13 17:04:38 2003
+++ ZODB4/src/zodb/storage/file.py	Thu Mar 13 17:11:35 2003
@@ -131,16 +131,15 @@
 
 from __future__ import generators
 
-import base64
-from cPickle import Pickler, Unpickler, loads
-import errno
 import os
-import struct
 import sys
 import time
-from types import StringType
-from struct import pack, unpack
+import errno
+import base64
+import struct
 import logging
+from struct import pack, unpack
+from cPickle import Pickler, Unpickler, loads
 
 try:
     from posix import fsync
@@ -686,8 +685,7 @@
         # We are going to commit by simply storing back pointers.
         if self._is_read_only:
             raise ReadOnlyError()
-        if not (src and isinstance(src, StringType)
-                and isinstance(dest, StringType)):
+        if not (src and isinstance(src, str) and isinstance(dest, str)):
             raise interfaces.VersionCommitError('Invalid source version')
 
         if src == dest:
@@ -1844,15 +1842,15 @@
     __implements__ = IStorageIterator
 
     def __init__(self, file, start=None, stop=None):
-        if isinstance(file, StringType):
+        if isinstance(file, str):
             file = open(file, 'rb')
         self._file = file
         self._read_metadata()
         file.seek(0,2)
         self._file_size = file.tell()
         self._pos = self._metadata_size
-        assert start is None or isinstance(start, StringType)
-        assert stop is None or isinstance(stop, StringType)
+        assert start is None or isinstance(start, str)
+        assert stop is None or isinstance(stop, str)
         if start:
             self._skip_to_start(start)
         self._stop = stop