[Zope-dev] Re: How bad _are_ ConflictErrors

Dieter Maurer dieter at handshake.de
Tue Nov 22 14:50:03 EST 2005


Florent Guillaume wrote at 2005-11-22 00:13 +0100:
> ...
>I'm actually not sure what's logged when a Conflict Error makes it back 
>to the users, offhand I don't see anything in my logs. Can someone 
>confirm or infirm that fact?
>
>If nothing is logged, I'll add something at level ERROR.

I fear nothing is logged.

If you are at it you should make the log entry for ConflictError
much more informative by logging the "str" of the "ConflictError" instance.
It will tell: the conflicting object, the type of the conflict
and the participating versions.

>BTW does someone have a handy script to provoke conflict errors on a 
>naked Zope?

They are most easily reproduced with local transactions:

     conn1 = db.open(); conn1.setLocalTransaction(); r1 = conn1.root()
     conn2 = db.open(); conn2.setLocalTransaction(); r2 = conn2.root()

     r1['a'] = 1; r2['a'] = 2
     conn1.getTransaction().commit()
     conn2.getTransaction().commit()

Note that "setLocalTransaction" is deprecated in ZODB 3.4.
You get similar effects with special "TransactionManager"s (look
at how "setLocalTransaction" is implemented).


If you only want to check your logging extension, you can just
raise a "ConflictError".


-- 
Dieter


More information about the Zope-Dev mailing list