I believe the following code creates a separate connection for each
Publisher and then reuses the connection
across requests (to any one publisher).
from ZEO import ClientStorage
from ZODB import DB
addr = ('localhost',9999)
from scgi.quixote_handler import QuixoteHandler, main
from quixote.publish import Publisher
class FacilitronPublisher(Publisher):
def __init__(self,root_namespace,config=None):
Publisher.__init__(self,root_namespace,config)
storage = ClientStorage.ClientStorage(addr)
self._db = DB(storage)
self.conn=self._db.open()
self.root=self.conn.root()
def start_request(self,request):
Publisher.start_request(self,request)
#make sure updates by others are processed
self.conn.sync()
request.dbroot = self.root