[schooltool-dev] Deleting objects with ZEO
Will Dickerson
wdickers at gmail.com
Mon Jun 18 01:56:29 EDT 2007
I am using a ZEO client with schooltool for use with my SIF Pull Agent. I'm
using a simple dictionary as a queue in the ZODB, however when I attempt to
delete items from the dictionary, the object inside of the database remains
unchanged. Is there an extra step besides transaction.commit()?
>>> queue =3D openDb()['queue']
>>> queue
{'Hamburger': 'Foobar'}
>>> queue.clear()
>>> queue
{}
>>> transaction.commit()
>>> closeDb()
>>> queue =3D openDb()['queue']
>>> queue
{'Hamburger': 'Foobar'}
The following is how I open and close the database in the real application.
from ZODB import DB
from ZEO import ClientStorage
def openDb(self):
storage =3D ClientStorage.ClientStorage(self.conf['dbName'])
db =3D DB(storage)
# open cursor and get root
self.cx =3D db.open()
self.dbroot =3D self.cx.root()
stRoot =3D self.dbroot.setdefault('stAgent', {})
stRoot.setdefault('queue', {})
def closeDb(self):
self.cx.close()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.schooltool.org/pipermail/schooltool-dev/attachments/20070=
618/c3155db2/attachment.htm
More information about the Schooltool-dev
mailing list