[Twisted-Python] adapi.Connection._runQuery always does rollback()

Thomas Raschbacher lordvan at lordvan.com
Sat Apr 26 14:19:01 MDT 2003


hi!

you did this in your 'application' code? (you know that this will block
your whole twisted app for the time of the query right? since MySQLdb is
not async .. and u'd need a thread to make it kinda async ..)

regards
<quote who="Eric C. Newton">
> Alrighty.  In case anyone else needs to do this before the MySQL
> Python API is brought up-to-date, here's how I kludged it without
> changing twisted:
>
>     import MySQLdb
>
>     def doNothing(*args, **kw):
>        return None
>
>     class AddRollback:
>        def __init__(self, module):
> 	  self.doConnect = module.connect
>
>        def connect(self, *args, **kw):
> 	  result = self.doConnect(*args, **kw)
> 	  result.rollback = doNothing
> 	  return result
>
>     MySQLdb.connect = AddRollback(MySQLdb).connect
>


-- 
-----BEGIN GEEK CODE BLOCK-----
GCS/CC/E/M/MU/S d- s: a--- C++++(++) UL++++ P+ L++++ E W+++ N+++ o-- K w-- O
M-- V- PS+ PE-- Y++ PGP+++ t+++ 5+ X- R tv b++++ DI- D+ G++ e-->+++++ h-- !r
z-
------END GEEK CODE BLOCK------


-----------------------------------------
This email was sent using SquirrelMail.
   "Webmail for nuts!"
http://squirrelmail.org/






More information about the Twisted-Python mailing list