
(Moved just onto the developers list, in case people are getting annoyed with the duplicate messages, and on the assumption we're all on it)
On Mon, 10 Nov 2003 11:36:38 -0500 Barry Warsaw <barry@python.org> wrote:
I'm trying to catch up on this thread, so apologies if these questions are already answered... np.
Had me worried there for a while though.
Untested code example:
from MySQLdb import OperationalError from MySQLdb.constants.CR import SERVER_LOST
def _doquery(self, sqlcmd): try: self._conn.query(sqlcmd) except OperationalError, e: code, msg = e if code <> SERVER_LOST: raise self._open()
Heh.
Excceptions make me nervous.
FWIW. I think the ping() based implementation is probably the best one to go for, because it doesn't raise any exceptions (so say the MySQL[db] docs, anyway), and it automagically reconnects internally to MySQL's own code if it can. No point in making work for ourselves, eh? ;-)
Although, importing the MySQLdb errorcodes is a good idea, and perhaps I'll make use of them in a future version.
All of which reminds me, must document the fact that if you change the MySQL connection details, (I think) you need to restart Mailman.
Anyways, thanks for the responses.
If you're not totally appauled by the code quality, and you think it'll work, let me know, and (if necessary) I'll upload it to the sourceforge site patches section, from which you may apply a GPL license to it (as far as I'm concerned, and I think it's safe from the perspective of the related software, etc.), and do what you wish with it, as long as it's appropriately credited, and, for preference continues to include a link to http://www.orenet.co.uk/ in it.
K.
-- Kev Green, aka Kyrian. "Be excellent to each other" -- Bill & Ted. Email: kyrian@ore.org Web: http://kyrian.ore.org/ ISP/Perl/PHP/Linux/Security Contractor, via http://www.orenet.co.uk/