John Mudd
mudd at vex.net
Sun Mar 28 08:11:03 EST 2004
I tend to agree with you. I was just sitting here trying to map it out with the xmlrpclib module. But, you're right, there's Pyro which may be a more complete solution. It's temping. Maybe I can store a pyro connection remote object in the session object? That would eliminate the need for a dictionary. And, assuming I can register a cleanup function for a session, the connection could be automatically closed when the session expires. John On Sun, 2004-03-28 at 07:49, vincent delft wrote: > I'm not sure (because not currently tested with > mod_python), but pyro (or xmlrpc) will solve all your > concerns concerning concurrent access ... > Then the only thing to set-up is the db connection. > > > > Just an idea .... throuw it away if I'm wrong. > > > > --- John Mudd <mudd at vex.net> wrote: > > I've looked at the following mod_python FAQ entry: > > > > 3.3. What is the best way to make > > persistent connections to a database? > > > > > > > > So, I just need some global variables as in this > > example. > > > > def handler(req): > > > > > > global persist, conn > > > > > > try: > > persist += 1 > > # No need to create the db connection here. > > except NameError: > > persist = 0 > > conn = db.open() # Create a db connection. > > > > > > At least this is easy. But there's no guarantee my > > next request will > > reuse the same thread/process. So I might (will) > > end up with extra db > > connections in other threads/processes. For my > > application that's not > > so bad. > > > > Hmmm... I may want to add code to also check if the > > session has changed > > (e.g. the user has re-logged in). Then close/reopen > > a db connection if > > the user has logged in again. That would give me an > > external control so > > I can force a new db connection by re-logging into > > my application. > > > > And maybe I should also register a cleanup function > > to close the > > connection. > > > > > > > > > > Am I on the right track? > > > > _______________________________________________ > > Mod_python mailing list > > Mod_python at modpython.org > > > http://mailman.modpython.org/mailman/listinfo/mod_python > > > __________________________________ > Do you Yahoo!? > Yahoo! Finance Tax Center - File online. File on time. > http://taxes.yahoo.com/filing.html
|