[ZODB-Dev] Fixing POSKeyErrors :-)

Chris Withers chris at simplistix.co.uk
Wed Feb 13 10:19:52 EST 2008


Hi Shane,

Shane Hathaway wrote:
> As a slight improvement, something like this should also work (untested):
> 
>>>> data._p_jar = app._p_jar
>>>> data._p_oid = oid
>>>> app._p_jar.register(data)
>>>> import transaction
>>>> transaction.get().note('Fix POSKeyError')
>>>> transaction.commit()

I did try this:

 >>> data._p_jar = app._p_jar
 >>> data._p_oid = oid
 >>> app.x = data
 >>> import transaction
 >>> transaction.get().note('Fix POSKeyError')
 >>> transaction.commit()

...but it didn't work. I don't know if the differences are significant.

> I'm not sure the situation is as bad as you're suggesting, since I
> vaguely recall that inter-object references encode the class of the
> referenced object, allowing a parent to load even if its child is gone.

Yes, but it's my understanding that when the parent is loaded, it tries 
to create ghosts for all referenced objects. At this point, POSKeyErrors 
get raised which prevents the parent being loaded.

Does anyone know what the situation is with this for definite?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the ZODB-Dev mailing list