[Zope3-checkins] CVS: ZODB4/src/zodb - connection.py:1.18 db.py:1.14 export.py:1.6 interfaces.py:1.16

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


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

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


=== ZODB4/src/zodb/connection.py 1.17 => 1.18 ===
--- ZODB4/src/zodb/connection.py:1.17	Thu Mar 13 16:32:27 2003
+++ ZODB4/src/zodb/connection.py	Thu Mar 13 17:11:34 2003
@@ -41,7 +41,7 @@
 import struct
 import tempfile
 import threading
-from types import StringType, ClassType, TupleType
+from types import ClassType
 
 from zodb import interfaces
 from zodb.conflict import ResolvedSerial
@@ -411,7 +411,7 @@
         # again.
         if not store_return:
             return
-        if isinstance(store_return, StringType):
+        if isinstance(store_return, str):
             assert oid is not None
             serial = store_return
             obj = self._cache.get(oid, None)
@@ -425,7 +425,7 @@
                 obj._p_serial = serial
         else:
             for oid, serial in store_return:
-                if not isinstance(serial, StringType):
+                if not isinstance(serial, str):
                     raise serial
                 obj = self._cache.get(oid, None)
                 if obj is None:


=== ZODB4/src/zodb/db.py 1.13 => 1.14 ===
--- ZODB4/src/zodb/db.py:1.13	Thu Mar 13 16:32:27 2003
+++ ZODB4/src/zodb/db.py	Thu Mar 13 17:11:34 2003
@@ -21,7 +21,6 @@
 import sys
 from threading import Lock
 from time import time, ctime
-from types import StringType
 import logging
 
 from zodb.storage.interfaces import *


=== ZODB4/src/zodb/export.py 1.5 => 1.6 ===
--- ZODB4/src/zodb/export.py:1.5	Thu Mar 13 16:32:27 2003
+++ ZODB4/src/zodb/export.py	Thu Mar 13 17:11:34 2003
@@ -21,7 +21,6 @@
 from cStringIO import StringIO
 from cPickle import Pickler, Unpickler
 from tempfile import TemporaryFile
-from types import StringType, TupleType
 
 export_end_marker = '\377' * 16
 
@@ -33,7 +32,7 @@
     def exportFile(self, oid, file=None):
         if file is None:
             file = TemporaryFile()
-        elif isinstance(file, StringType):
+        elif isinstance(file, str):
             file = open(file, 'w+b')
         file.write('ZEXP')
         oids = [oid]
@@ -62,7 +61,7 @@
         # needs to write pickles into the storage, which only allows
         # store() calls between tpc_begin() and tpc_vote().
 
-        if isinstance(file, StringType):
+        if isinstance(file, str):
             file = open(file,'rb')
         magic = file.read(4)
 


=== ZODB4/src/zodb/interfaces.py 1.15 => 1.16 ===
--- ZODB4/src/zodb/interfaces.py:1.15	Thu Mar 13 16:32:27 2003
+++ ZODB4/src/zodb/interfaces.py	Thu Mar 13 17:11:34 2003
@@ -26,8 +26,6 @@
 $Id$
 """
 
-from types import StringType, DictType
-
 import zodb.utils
 from zope.interface import Interface, Attribute