Skip to content

Instantly share code, notes, and snippets.

@simahawk
Created April 20, 2012 13:19
Show Gist options
  • Save simahawk/2428496 to your computer and use it in GitHub Desktop.
Save simahawk/2428496 to your computer and use it in GitHub Desktop.
temporary fix for ZODB connection KeyError
# temporary hack for fixing ZODB connection error
from ZODB import FileStorage, DB
dbname = 'my_missing_db'
path = 'path/to/missing/storage.fs'
storage = FileStorage.FileStorage(path)
db = DB(storage)
# app is the zope instance in debug mode
app._p_jar._db.databases[dbname] = db
# as a temp hack you can use this into ZODB.Connection.get_connection method
# (just replace 'app._p_jar' with 'self')
##### DO THIS AT YOUR OWN RISK! #####
##### DO THIS WITH A BACKUP! #####
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment