[Zope-Checkins] CVS: ZODB3/ZODB - Connection.py:1.98.6.7

Jeremy Hylton jeremy@zope.com
Wed, 9 Jul 2003 15:37:27 -0400


Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv10940/ZODB

Modified Files:
      Tag: zodb33-devel-branch
	Connection.py 
Log Message:
Update _persistent_load() to modern idioms.


=== ZODB3/ZODB/Connection.py 1.98.6.6 => 1.98.6.7 ===
--- ZODB3/ZODB/Connection.py:1.98.6.6	Mon Jul  7 14:15:38 2003
+++ ZODB3/ZODB/Connection.py	Wed Jul  9 15:37:22 2003
@@ -163,12 +163,10 @@
             self._root_=object # keep a ref
         return object
 
-    def _persistent_load(self,oid,
-                        tt=type(())):
+    def _persistent_load(self, oid):
+        __traceback_info__ = oid
 
-        __traceback_info__=oid
-
-        if type(oid) is tt:
+        if isinstance(oid, tuple):
             # Quick instance reference.  We know all we need to know
             # to create the instance wo hitting the db, so go for it!
             oid, klass = oid
@@ -176,19 +174,19 @@
             if obj is not None:
                 return obj
 
-            if type(klass) is tt:
+            if isinstance(klass, tuple):
                 module, name = klass
-                try: klass=self._db._classFactory(self, module, name)
+                try:
+                    klass = self._db._classFactory(self, module, name)
                 except:
-                    # Eek, we couldn't get the class. Hm.
-                    # Maybe their's more current data in the
-                    # object's actual record!
+                    # Eek, we couldn't get the class. Hm.  Maybe there's
+                    # more current data in the object's actual record!
                     return self[oid]
 
-            object=klass.__new__(klass)
-            object._p_oid=oid
-            object._p_jar=self
-            object._p_changed=None
+            object = klass.__new__(klass)
+            object._p_oid = oid
+            object._p_jar = self
+            object._p_changed = None
 
             self._cache[oid] = object