[Twisted-Python] Twisted Enterprise (newbie question)
Glyph Lefkowitz
glyph at twistedmatrix.com
Thu May 23 10:18:20 MDT 2002
From: Steve Waterbury <steve.waterbury at gsfc.nasa.gov>
Subject: Re: [Twisted-Python] Twisted Enterprise (newbie question)
Date: Thu, 23 May 2002 11:36:48 -0400
> So I created a "runQuery" method for adbapi.ConnectionPool:
>
> def runQuery(self, *args, **kw):
> d = defer.Deferred()
> apply(self.query, (d.callback,d.errback)+args, kw)
> return d
>
> ... and now my script works! (Has adbapi.ConnectionPool been fixed yet
> in the CVS version?)
You probably want to be using adbapi.Augmentation; which, curiously enough, has
a method "runQuery" ...
def runQuery(self, *args, **kw):
d = defer.Deferred()
apply(self.dbpool.query, (d.callback, d.errback)+args, kw)
return d
... that looks an awful lot like what you want :-) This was taken from
http://twistedmatrix.com/users/jh.twistd/viewcvs/cgi/viewcvs.cgi/twisted/enterprise/adbapi.py?rev=1.26&content-type=text/vnd.viewcvs-markup&only_with_tag=release-0_17_3&cvsroot=Twisted
which is not the most recent CVS, so it should be in the copy you have.
I guess that division seems fairly arbitrary, but Augmentation is designed to
be an interface to a particular schema, whereas ConnectionPool manages the
database connections.
HTH,
--
| <`'> | Glyph Lefkowitz: Travelling Sorcerer |
| < _/ > | Lead Developer, the Twisted project |
| < ___/ > | http://www.twistedmatrix.com |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: </pipermail/twisted-python/attachments/20020523/11719152/attachment.sig>
More information about the Twisted-Python
mailing list