[ZODB-Dev] Re: KeyError / POSKeyError

Tim Tisdall tisdaltn at mcmaster.ca
Thu Mar 29 12:02:09 EDT 2007


  Okay...  I've managed to create a persistent object called 'p' with
the OID of the missing object.  I have no idea how to determine the
database connection object to pass it to the
ZODB.Connection.Connection.add() .

  -Tim

On 3/27/07, Dieter Maurer <dieter at handshake.de> wrote:
> 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