Edgewall Software

Opened 7 years ago

Last modified 7 years ago

#11313 closed defect

mysql_backend with parameters raises TypeError on initenv — at Initial Version

Reported by: Jun Omae Owned by:
Priority: normal Milestone: 1.0.2
Component: database backend Version: 1.0-stable
Severity: normal Keywords: mysql
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

When executing initenv command with mysql backend and init_command parameter, it raises TypeError: Connect() keywords must be strings.

Parameters for mysql backend are introduced in [10407], #5120.

$ python trac/admin/console.py /var/trac/1.0-test
Welcome to trac-admin 1.0.2dev
Interactive Trac administration console.
Copyright (C) 2003-2013 Edgewall Software

Type:  '?' or 'help' for help on commands.

Trac [/var/trac/1.0-test]> initenv "Trac 1.0-stable w/ MySQL" "mysql://tracuser:password@localhost/trac_1_0_test?init_command=SET storage_engine%3dMyISAM"
Creating and Initializing Project
Initenv for '/var/trac/1.0-test' failed.
Failed to create environment.
Connect() keywords must be strings
Traceback (most recent call last):
  File "trac/admin/console.py", line 456, in do_initenv
    options=options)
  File "/home/jun66j5/src/trac/edgewall/git/trac/core.py", line 124, in __call__
    self.__init__(*args, **kwargs)
  File "/home/jun66j5/src/trac/edgewall/git/trac/env.py", line 280, in __init__
    self.create(options)
  File "/home/jun66j5/src/trac/edgewall/git/trac/env.py", line 580, in create
    DatabaseManager(self).init_db()
  File "/home/jun66j5/src/trac/edgewall/git/trac/db/api.py", line 251, in init_db
    connector.init_db(**args)
  File "/home/jun66j5/src/trac/edgewall/git/trac/db/mysql_backend.py", line 111, in init_db
    params)
  File "/home/jun66j5/src/trac/edgewall/git/trac/db/mysql_backend.py", line 92, in get_connection
    cnx = MySQLConnection(path, log, user, password, host, port, params)
  File "/home/jun66j5/src/trac/edgewall/git/trac/db/mysql_backend.py", line 275, in __init__
    port=port, charset='utf8', **opts)
TypeError: Connect() keywords must be strings
make: *** [console] Error 1
  • trac/db/mysql_backend.py

    diff --git a/trac/db/mysql_backend.py b/trac/db/mysql_backend.py
    index cea17b2..b2537c6 100644
    a b class MySQLConnection(ConnectionWrapper):  
    263263            port = 3306
    264264        opts = {}
    265265        for name, value in params.iteritems():
     266            name = name.encode('utf-8')
    266267            if name in ('init_command', 'read_default_file',
    267268                        'read_default_group', 'unix_socket'):
    268269                opts[name] = value

Change History (0)

Note: See TracTickets for help on using tickets.