Author: phd
Date: 2007-03-06 08:30:21 -0700 (Tue, 06 Mar 2007)
New Revision: 2400
Modified:
SQLObject/branches/0.7/sqlobject/mysql/mysqlconnection.py
Log:
MySQLdb.version_info[:3] >= (1, 2, 1) is much more readable and pythonic.
Modified: SQLObject/branches/0.7/sqlobject/mysql/mysqlconnection.py
===================================================================
--- SQLObject/branches/0.7/sqlobject/mysql/mysqlconnection.py 2007-03-06 15:11:05 UTC (rev 2399)
+++ SQLObject/branches/0.7/sqlobject/mysql/mysqlconnection.py 2007-03-06 15:30:21 UTC (rev 2400)
@@ -19,9 +19,7 @@
self.user = user
self.password = passwd
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
@@ -53,9 +51,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 self.module.OperationalError(
|