I'm having troubles opening and closing the standalone ZODB with an OOBTree. def opendb(): path = os.path.expanduser('~/zodb/zodb.fs') try: storage = FileStorage.FileStorage(path) db = DB(storage) conn = db.open() dbroot = conn.root() if not dbroot.has_key('authors'): dbroot['authors'] = OOBTree() dbroot = conn.root() return (dbroot, conn, db, storage) except: return False def closedb(database): try: get_transaction.abort() database[0].close() database[1].close() database[2].close() return True except: return False
db = opendb() db[0] {'authors': <BTrees._OOBTree.OOBTree object at 0x82e1dac>} db[1] <Connection at 082f6d6c> db[2] <ZODB.DB.DB object at 0x81dd34c> closedb(db) False db[0].close Traceback (most recent call last): File "<stdin>", line 1, in ? AttributeError: 'PersistentMapping' object has no attribute 'close' db[1].close <bound method Connection.close of <Connection at 082f6d6c>> db[2].close <bound method DB.close of <ZODB.DB.DB object at 0x81dd34c>>
How should the OOBTree closed?