Edgewall Software

Ticket #4459: mysql_import_fix-r5398.patch

File mysql_import_fix-r5398.patch, 1.4 KB (added by cboos, 5 years ago)

Potential fix for the issue, patch on latest trunk, which applies on 0.10-stable as well (ignore the failure for the second hunk)

  • trac/db/mysql_backend.py

     
    2323 
    2424_like_escape_re = re.compile(r'([/_%])') 
    2525 
     26import MySQLdb 
    2627 
    2728class MySQLConnector(Component): 
    2829    """MySQL database support for version 4.1 and greater. 
     
    4344                       port=None, params={}): 
    4445        cnx = MySQLConnection(path, user, password, host, port, params) 
    4546        if not self._version: 
    46             import MySQLdb 
    4747            self._version = get_pkginfo(MySQLdb).get('version', 
    4848                                                     MySQLdb.__version__) 
    4949            mysql_info = 'server: "%s", client: "%s", thread-safe: %s' % \ 
     
    127127        Note that the tuple only checks the major, minor, and sub versions; 
    128128        the sub-sub version is weird, so we only check for 'final' versions. 
    129129        """ 
    130         from MySQLdb import version_info as ver 
     130        ver = MySQLdb.version_info 
    131131        if ver[0] < v[0] or ver[1] < v[1] or ver[2] < v[2]: 
    132132            return False 
    133133        if ver[3] != 'final': 
     
    144144 
    145145    def __init__(self, path, user=None, password=None, host=None, 
    146146                 port=None, params={}): 
    147         import MySQLdb 
    148  
    149147        if path.startswith('/'): 
    150148            path = path[1:] 
    151149        if password == None: