On Fri, 2004-04-02 at 17:37, Dieter Maurer wrote:
Syver Enstad wrote at 2004-4-2 11:38 +0200:
I am checking out how to use ZODB with twisted web. I thought that I would have the DB instance globally accesible and call the open method to get a connection on each request. I thought that if I use connection.getTransaction().commit() before sending the response I will commit on the connection for that request. Is this necesarily true when using twisted web because it is single threaded and it seems that ZODB finds the correct transaction by checking the thread.
This is true only, when you are working with "local transaction mode" (i.e. you are calling "connection.setLocalTransaction()").
Currently, this mode restricts you to a single transaction client. Neither relational databases nor other transactional clients understand this mode. Moreover, you cannot use "DBTab" to "mount" several ZODB storages.
i wouldnt say it restricts you to a single txn client, local transaction mode with twisted allows for the primary goal of using single threaded twisted with zodb txn semantics bound to protocol instances/clients, and the txn framework is still perfectly capable, just that the resource integration of other txn aware resources needs to play well with zodb conn based txns, which basically rules out most of the existing zope products as they use a global accessor to the transaction as opposed to call getTransaction on a conn which would still allow zodb to play a txn authority/manager role. but at the level of using twisted and zodb directly those products wouldn't likely be all that useful. -cheers, -kapil