dirceu (owner)

Revisions

gist: 29057 Download_button fork
public
Public Clone URL: git://gist.github.com/29057.git
Embed All Files: show embed
remove_ghost_obj.py #
1
2
3
4
5
6
7
8
9
10
11
12
# The following code can be used to delete an object that is return POSKeyErrors
# on a ZODB database. Run it using 'zopectl debug'. Tested with Zope 2.9.
 
container_id = '/path/to/container'
screwed_object_id = 'screwed_obj'
 
from ZODB.POSException import POSKeyError
import transaction
obj = app.unrestrictedTraverse(container_id)
obj._objects = tuple(filter(lambda i,n = id: i['id'] != n, obj._objects))
delattr(obj, screwed_object_id)
transaction.commit()