[Zope] The immortal POSKeyError

Roché Compaan roche at upfrontsystems.co.za
Mon Jul 19 15:57:31 EDT 2004


* Roché Compaan <roche at upfrontsystems.co.za> [2004-07-19 21:27]:
> * george donnelly <list at zettai.net> [2004-07-19 21:09]:
> > Roché Compaan <roche at upfrontsystems.co.za> on 7/17/04 wrote:
> > 
> > >If you're lucky, it's just the ZODB index file that got corrupted, so
> > >try deleting 'Data.fs.index', and hope it rebuilds itself correctly
> > when
> > >restarting. I probably don't have to tell you this but do it on a copy
> > >of your instance.
> > 
> > thanks but nope that's not it
> 
> Try removing the reference from the parent folder, without accessing the
> bad object:
> 
>     id = 'BadId'
>     folder._objects=tuple(filter(lambda i,n=id: i['id']!=n, folder._objects))
>     delattr(folder, id)
> 
> 'manage_delObjects', calls '_getOb' to do additional checks before
> deleting an object, and in your case this will give a POSKeyError.
> 
> You'll be left with a dangling reference, but at least siblings of the
> bad folder will be accessible again.

Actually the reference will be gone, so the bad object should get packed
away if I'm not mistaken.

-- 
Roché Compaan
Upfront Systems                 http://www.upfrontsystems.co.za


More information about the Zope mailing list