[ZODB-Dev] Re: KeyError / POSKeyError

Dieter Maurer dieter at handshake.de
Tue Mar 27 15:54:01 EDT 2007


Tim Tisdall wrote at 2007-3-27 14:59 -0400:
>   When I try to access any part of the plone instance I'm given the
>same exceptions I mentioned before.  I can't seem to access any
>subobjects.  Am I doomed?

You mean a "POSKeyError"?

Then, you are not (yet) completely doomed. You can try the following:

  You create a persistent object, assign it the missing oid as
  "_p_oid" (you can use the "ZODB.utils.p64" to convert an integer
  to the required 8 byte binary representation) and
  then you emulate a call to "ZODB.Connection.Connection.add" for
  your object (of course without the "assert obj._p_oid is None"
  and the "obj._p_pid = self._storage.new_oid()").
  Then you commit the transaction.

  This should create an object with the missing oid (of course, not
  the correct one). If you are lucky, your object will be loadable
  after this operation.



-- 
Dieter


More information about the ZODB-Dev mailing list