Just figured it out, hope it's helpful to someone.
import threading
import time
from ZODB import DB,FileStorage
import transaction

class myThread(threading.Thread):
    def run(self):
        time.sleep(1)
        print "Access from thread"
        threadConn = db.open()
        threadRoot = threadConn.root()
        print "The root as opened by the thread:",threadRoot
        print "Main writing to the root"
        threadRoot['thread']=1
        print "Committing transcation"
        transaction.commit()

newThread = myThread()

storage = FileStorage.FileStorage('data.fs')
db = DB(storage)

newThread.start()
print "Access from main"
mainConn = db.open()

mainRoot = mainConn.root()
print "The root as opened by the main:",mainRoot
print "Main writing to the root"
mainRoot['main']=1
print "Committing transaction"
transaction.commit()


newThread.join()

Regards,
Kenneth Miller
_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev

Reply via email to