[Twisted-Python] adbapi weirdness
Steve Freitas
sflist at ihonk.com
Wed Jul 30 22:13:05 MDT 2003
Hi all,
Here's the latest thing I can't figure out.
If I do this and make an XML-RPC call to dbtest(), it runs fine:
class takeOne(xmlrpc.XMLRPC):
def __init__(self):
self.dbpool = adbapi.ConnectionPool("pyPgSQL.PgSQL", \
host='127.0.0.1', user='postgres', database='template1')
self.db = adbapi.Augmentation(self.dbpool)
self.prefs = Env(self.db)
def xmlrpc_dbtest(self):
result = self.db.runQuery("select * from prefs")
return result
def xmlrpc_listPrefs(self):
return self.prefs.prefs
class Env:
def __init__(self, db):
self.db = db
self.prefs = self.db.runQuery("select * from prefs")
return
def main():
from twisted.internet.app import Application
app = Application("xmlrpc")
r = takeOne()
app.listenTCP(7080, server.Site(r))
return app
application = main()
if __name__ == '__main__':
application.run(save=0)
But a call to listPrefs() hangs until I make another, concurrent request to
dbtest(), at which point it comes through. Then if I try listPrefs() again,
it returns Fault 8002: Can't serialize output.
Any ideas? I'm suffering from all kinds of this weirdness: It hangs, then it
doesn't hang, then it returns properly, then it can't serialize from the same
function that worked a moment before. :-(
Thanks,
Steve
More information about the Twisted-Python
mailing list