[Twisted-Python] adbapi.Augmention

Christopher Armstrong radix at twistedmatrix.com
Thu Nov 13 16:03:03 MST 2003


On Thu, Nov 13, 2003 at 05:47:42PM -0500, Stephen C. Waterbury wrote:
> Jon Dyte wrote:
>
> >Presumbably this means DONT inherit from ConnectionPool like you
> >used to inherit from Augmentation( or am I reading that incorrectly)
> >and just create a ConnectionPool instance and run the queries through that.
> 
> Christopher Armstrong wrote:
> 
> >right.
> 
> But I think it works okay to subclass ConnectionPool ...
> at least, it works for me.  Is there a better way to
> do something like the following (which is working fine)?
> (Admittedly you need to see my other modules for the full
> picture, but you can infer what they would do ... as
> you can probably guess, I don't use t.e.row.RowObject.)

Sure, there's no particular reason that subclassing ConnectionPool
can't be done, but the only difference is that you're using methods
like "self.runQuery" instead of "self.db.runQuery" (after doing
"self.db = ConnectionPool(etc)". I probably wouldn't subclass unless I
actually wanted to override one of the methods in ConnectionPool with
a modified implementation and then use it in the same place that a
regular ConnectionPool is expected.

-- 
 Twisted | Christopher Armstrong: International Man of Twistery
  Radix  |          Release Manager,  Twisted Project
---------+           http://radix.twistedmatrix.com/




More information about the Twisted-Python mailing list