[Zope] Trying to trap ConflictError

dieter at handshake.de dieter at handshake.de
Thu Jul 6 14:56:54 EDT 2006

Jonathan wrote at 2006-7-6 09:53 -0400:
> ...
>>From what I understand from the above code, the error is being raised 
>because the oid already exists and the object pointed to by the old oid is 
>different from the object pointed to by the new oid, hence the conflict 

You interpretation is slightly wrong. What really differs is not
the object (or "oid") but the timestamp.

Each persistent object has a timestamp "_p_serial" which
identifies the transaction that made the last change to the object.

When an object is loaded from the ZODB, its timestamp is
recorded (in "_p_serial"). When later a change to the object
should be commited, the recorded timestamp is compared to the object's
current timestamp in the ZODB. If the timestamps differ, then
the object was modified by a concurrent transaction and our
modification is likely to be based on stale information.
As a result a "ConflictError" is raised.


More information about the Zope mailing list