[Zope3-Users] ZODB - root and transaction

Reinhold Strobl reinhold.strobl at gmx.net
Wed Apr 5 06:33:55 EDT 2006


Hi,

I have got two problems, which are related:

1. How do get a reference to the root object of the ZODB everywhere?

I mean I have found a solution like something:

            db = zapi.getUtility(IDatabase)
            conn = db.open()
            root = conn.root()
            root['123'] = newbook

But it does not acutally store the object in the database. 
I try to commit it, but

conn.getTransaction.commit()

won't work. I search instead for get_transaction(), but I didn't found it in
Python 's lib directory.

So, how do I save it???

2. How do I get (the current) transaction?

Thanks a lot in advance! 



More information about the Zope3-users mailing list