Mercurial > p > roundup > code
diff roundup/backends/back_mysql.py @ 6152:546763f4ce44
Make the charset configurable for mysql
We now have an option to configure the mysql charset used when opening
the database. The default is now utf8 for both, python2 and python3.
No charset argument is passed if this is configured to 'default'.
Previously we were passing 'utf8' for python3 and no charset option for
python2 which made regression tests fail depending on the mysql
configuration.
| author | Ralf Schlatterbeck <rsc@runtux.com> |
|---|---|
| date | Fri, 01 May 2020 17:13:15 +0200 |
| parents | 6a2de9606652 |
| children | a701c9c81597 |
line wrap: on
line diff
--- a/roundup/backends/back_mysql.py Fri May 01 16:34:35 2020 +0200 +++ b/roundup/backends/back_mysql.py Fri May 01 17:13:15 2020 +0200 @@ -54,10 +54,9 @@ del d['password'] if 'port' in d: d['port'] = int(d['port']) - # This was conditional on python version > 2 but seems to work fine - # with python2.7. According to the MySQLdb API docs, the charset - # argument is supported with MySQL 4.1 which was released in 2004. - d['charset'] = 'utf8' + charset = config.RDBMS_MYSQL_CHARSET + if charset != 'default': + d['charset'] = charset return d def db_nuke(config):
