[Zope] ZODB question - obtaining type information from known OID

Dieter Maurer dieter at handshake.de
Sun Oct 10 17:05:31 EDT 2004


Sean Hastings wrote at 2004-10-9 13:14 -0400:
>I am trying to track down some write conflict errors in a Product I am
>working on.
>
>The event.log is telling me (for example):
>
>ConflictError: database conflict error (oid 000000000011e870, serial was
>0358665aa2650baa, now 0358665a4ba78c99)
>
>I would like to find out what class of object is producing the conflict, so
>I can write an _p_resolveConflict function to handle the problem, but the
>log doesn't tell me the conflicting objects type.

If you have a persistent object "o", then "o._p_jar" is its ZODB
connection.

If you have a ZODB connection "C" and an oid (as a binary string),
then "C[oid]" loads the object and returns it.

You can use "from binascii import a2b_hex" to convert
the oid as given above into a binary string:

    e.g. "C[a2b_hex('000000000011e870')]"

-- 
Dieter


More information about the Zope mailing list