Author: phd
Date: 2007-03-06 08:30:43 -0700 (Tue, 06 Mar 2007)
New Revision: 2402
Modified:
SQLObject/trunk/sqlobject/mysql/mysqlconnection.py
Log:
MySQLdb.version_info[:3] >= (1, 2, 1) is much more readable and pythonic.
Modified: SQLObject/trunk/sqlobject/mysql/mysqlconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/mysql/mysqlconnection.py 2007-03-06 15:30:33 UTC (rev 2401)
+++ SQLObject/trunk/sqlobject/mysql/mysqlconnection.py 2007-03-06 15:30:43 UTC (rev 2402)
@@ -28,9 +28,7 @@
self.user = user
self.password = password
self.kw = {}
- if MySQLdb.version_info[0] > 1 or (MySQLdb.version_info[0] == 1 and \
- (MySQLdb.version_info[1] > 2 or \
- (MySQLdb.version_info[1] == 2 and MySQLdb.version_info[2] >= 1))):
+ if MySQLdb.version_info[:3] >= (1, 2, 1):
self.need_unicode = True
else:
self.need_unicode = False
@@ -62,9 +60,7 @@
try:
conn = self.module.connect(host=self.host, port=self.port,
db=self.db, user=self.user, passwd=self.password, **self.kw)
- if MySQLdb.version_info[0] > 1 or (MySQLdb.version_info[0] == 1 and
- (MySQLdb.version_info[1] > 2 or (MySQLdb.version_info[1] == 2 and
- MySQLdb.version_info[2] >= 2))):
+ if MySQLdb.version_info[:3] >= (1, 2, 2):
conn.ping(True) # Attempt to reconnect. This setting is persistent.
except self.module.OperationalError, e:
raise OperationalError(
|