Jeremy M. Smith wrote at 2003-5-27 15:36 -0700:
... With this one folder, I get a POSKeyError. After researching this problem online, I used the fsrefs.py utility to determine which object it is that's not being found, but I can't figure out how to either a) get that object back (since I can't access the management screens due to the error) or b) remove the invalid references. I have seen some references to truncating (a copy of) the Data.fs just before the transaction that causes the error, but I haven't found any instructions on how to do this.
You know that you can access the ZODB outside of Zope? For this to be possible, you must either stop Zope or use ZEO. It then looks like this (I assume a Unix setup with "bash"; the shell commands are different for Windows): # you are inside your Zope directory export PYTHONPATH=$PYTHONPATH:$PWD/lib/python python from Zope import app root= app() # "root" contains your root object obj= root.unrestrictedTraverse(url_to_obj) # assume, "obj" now contains the folder with the dangling # reference; we must find the id belonging to the reference for id,val in obj.objectItems(): try: val.getId() except POSKeyError: break # "id" should now contain the id with the broken object # we give it a new one obj._setOb(id,DTMLMethod('',__name__=id)) # now we delete it obj.manage_delObject(id) # commit get_transaction().commit() The script is not complete. You must import "POSKeyError" and "DTMLMethod" and provide "url_to_obj". Dieter