[Twisted-Python] twisted.web and MySQLdb

James Y Knight foom at fuhm.net
Tue Oct 28 22:06:59 EST 2003

On Oct 28, 2003, at 6:10 PM, Nathan Seven wrote:

> --- phil at bubblehouse.org wrote:
>> I'm using MySQLdb to interface with my sql server,
>> but i'm not really sure
>> what to do with my connection object once it's
>> created. i want to put it
>> somewhere that will be easy to access for the rest
>> of the modules, but
>> obviously i don't want it to be persisted when the
>> TAP is saved....
> .
> Hmmm- well I'm just getting started here as well- but
> yeah, I don't remember any mentioned way of
> selectively removing state information for objects.
> I don't like the whole state-saving stuff at all- I'm
> doing atomic DB stuff, so my "state" above all is
> maintained on the DB itself.
> The Twisted clients are just basically dumb
> transaction handlers.

You should just not use the whole pickled app/saving state thing. Then 
you don't have to worry about this stuff at all. In addition the next 
person who comes along and wants to debug something will thank you 
profusely when he doesn't have to sit there and ponder "gee, I wonder 
what parameters the last person gave to mktap, cause I really would 
like to startup a second copy of that app on another port. (or from a 
different directory, with a new file type handler, whatever)...".

I recommend configuring your webserver with python code and starting it 
with twistd -y. Perhaps not ideal but certainly better than the whole 
tap mess.

All IMO, of course.


More information about the Twisted-Python mailing list