[Zodb-checkins] CVS: Zope3/src/zodb - connection.py:1.21

Jeremy Hylton jeremy@zope.com
Thu, 20 Mar 2003 13:05:42 -0500


Update of /cvs-repository/Zope3/src/zodb
In directory cvs.zope.org:/tmp/cvs-serv19888

Modified Files:
	connection.py 
Log Message:
Add comment about check in _commit_store().
Replace dangerous hasattr() with getattr().


=== Zope3/src/zodb/connection.py 1.20 => 1.21 ===
--- Zope3/src/zodb/connection.py:1.20	Thu Mar 20 13:01:44 2003
+++ Zope3/src/zodb/connection.py	Thu Mar 20 13:05:41 2003
@@ -460,10 +460,13 @@
         if serial is None:
             self._created.add(oid)
         else:
+            # Make a quick check against the invalidated set, because
+            # pickling is expensive.  Catching a conflict here will
+            # be much faster than catching in the store call.
             self._inv_lock.acquire()
             try:
                 if (oid in self._invalidated and
-                    not hasattr(obj, '_p_resolveConflict')):
+                    getattr(obj, '_p_resolveConflict', None) is None):
                     raise ConflictError(oid=oid)
             finally:
                 self._inv_lock.release()