[Zope3-checkins] CVS: Zope3/lib/python/ZODB - Connection.py:1.71

Jeremy Hylton jeremy@zope.com
Wed, 17 Jul 2002 19:02:23 -0400


Update of /cvs-repository/Zope3/lib/python/ZODB
In directory cvs.zope.org:/tmp/cvs-serv3617/ZODB

Modified Files:
	Connection.py 
Log Message:
Get rid of one special case to support ZClasses.

Simply code that was checking for ConflictError.  And don't call
ConflictError ctor with undefined keywords args!



=== Zope3/lib/python/ZODB/Connection.py 1.70 => 1.71 ===
             self._created.append(oid)
         else:
             # We should only get here for the original object passed to commit
-            if ((self._invalidated.has_key(oid) and
-                 not hasattr(pobject, '_p_resolveConflict'))
-                or self._invalidated.has_key(None)):
-                raise ConflictError(oid=oid, serial=serial)
+            if (oid in self._invalidated and
+                not hasattr(pobject, '_p_resolveConflict')):
+                raise ConflictError(oid=oid)
             self._modified.append(oid)
 
         klass = pobject.__class__
 
-        # It's unclear what exactly this conditional is testing and
-        # why it takes one branch or the other.  It looks like a
-        # Persistent object will never has it's __getstate__() called.
-        if issubclass(klass, type): # XXX is this a persistent class
-            dict = {}
-            dict.update(pobject.__dict__)
-            # XXX we delete the _p_jar, but not, say, _p_oid?
-            del dict['_p_jar']
-            args = pobject.__name__, pobject.__bases__, dict
-            state = None
+        if hasattr(klass, '__getinitargs__'):
+            args = pobject.__getinitargs__()
+            len(args) # XXX Assert it's a sequence
         else:
-            if hasattr(klass, '__getinitargs__'):
-                args = pobject.__getinitargs__()
-                len(args) # XXX Assert it's a sequence
-            else:
-                args = None # New no-constructor protocol!
+            args = None # New no-constructor protocol!
 
-            module = getattr(klass,'__module__','')
-            if module:
-                klass = module, klass.__name__
-            __traceback_info__ = klass, oid, self._version
-            state = pobject.__getstate__()
+        module = getattr(klass,'__module__','')
+        if module:
+            klass = module, klass.__name__
+        __traceback_info__ = klass, oid, self._version
+        state = pobject.__getstate__()
 
         file.seek(0)
         pickler.clear_memo()