Opened 19 years ago
Closed 15 years ago
#429 closed defect (wontfix)
charset error with mysql
| Reported by: | Owned by: | Brad Anderson | |
|---|---|---|---|
| Priority: | highest | Component: | DbAuthPlugin |
| Severity: | blocker | Keywords: | |
| Cc: | Trac Release: | 0.11 |
Description (last modified by )
After installing dbauth on trac .10 dev and making the configuration changes suggested, I got the following error on logging on...
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 313, in dispatch_request
dispatcher.dispatch(req)
File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 183, in dispatch
req.authname = self.authenticate(req)
File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 143, in authenticate
authname = authenticator.authenticate(req)
File "build/bdist.linux-i686/egg/dbauth/auth.py", line 61, in authenticate
File "build/bdist.linux-i686/egg/dbauth/auth.py", line 197, in _get_name_for_cookie
File "build/bdist.linux-i686/egg/dbauth/env.py", line 22, in get_db
File "/usr/lib/python2.4/site-packages/trac/db/api.py", line 71, in get_connection
return self._cnx_pool.get_cnx()
File "/usr/lib/python2.4/site-packages/trac/db/pool.py", line 75, in get_cnx
cnx = self._connector.get_connection(**self._kwargs)
File "/usr/lib/python2.4/site-packages/trac/db/mysql_backend.py", line 40, in get_connection
return MySQLConnection(path, user, password, host, port, params)
File "/usr/lib/python2.4/site-packages/trac/db/mysql_backend.py", line 117, in __init__
port=port, use_unicode=True, charset='utf8')
File "/usr/lib/python2.4/site-packages/MySQLdb/__init__.py", line 66, in Connect
return Connection(*args, **kwargs)
File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line 134, in __init__
super(Connection, self).__init__(*args, **kwargs2)
TypeError: 'charset' is an invalid keyword argument for this function
Noticing the charset error, I tried the following which resolved the error and allowed me to login using the creditials in the mysql database
removing the reference to 'charset" in /usr/lib/python2.4/site-packages/trac/db/mysql_backend.py
cnx = MySQLdb.connect(db=path, user=user, passwd=password, host=host,
port=port, use_unicode=True, charset='utf8')
MODIFIED TO
cnx = MySQLdb.connect(db=path, user=user, passwd=password, host=host,
port=port, use_unicode=True)
Attachments (0)
Change History (4)
comment:1 Changed 19 years ago by
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
comment:2 Changed 19 years ago by
| Description: | modified (diff) |
|---|
comment:3 Changed 16 years ago by
| Resolution: | invalid |
|---|---|
| Status: | closed → reopened |
| Trac Release: | 0.10 → 0.11 |
Had also had this problem using Trac with MySQL 5.0.26. After removing the charset variable on this function I got this error: UnicodeEncodeError: 'latin-1' codec can't encode character u'\u201c' in position 1153: ordinal not in range(256)
Any suggestions to it?
comment:4 Changed 15 years ago by
| Resolution: | → wontfix |
|---|---|
| Status: | reopened → closed |
Closing tickets for a deprecated plugin.



This is a bug in Trac, or at least, different versioning of MySQLdb package. I encountered the same thing using 1.2.0 of MySQLdb and talked with dilinger on #trac at Freenode. He is using 1.2.1 and doesn't see the issue. I removed the charset param and it worked, but glad to see your mod works as well. You may want to post it on p.e.c.
In any case, this doesn't have much to do with the DbAuthPlugin