Changeset 3138

Show
Ignore:
Timestamp:
01/19/07 09:54:21 (18 years ago)
Author:
jerome
Message:

Fixed a connection error when charset is specified with mysql : we now retry without the charset argument.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/storages/mysqlstorage.py

    r3133 r3138  
    4747         
    4848        self.tool.logdebug("Trying to open database (host=%s, port=%s, dbname=%s, user=%s)..." % (host, port, dbname, user)) 
    49         self.database = MySQLdb.connect(host=host, port=port, db=dbname, user=user, passwd=passwd, charset="utf8") 
     49        try : 
     50            self.database = MySQLdb.connect(host=host, port=port, db=dbname, user=user, passwd=passwd, charset="utf8") 
     51        except TypeError :     
     52            self.tool.logdebug("'charset' argument not allowed with this version of python-mysqldb, retrying without...") 
     53            self.database = MySQLdb.connect(host=host, port=port, db=dbname, user=user, passwd=passwd) 
     54             
    5055        try : 
    5156            self.database.autocommit(1)