Modify

Opened 18 years ago

Closed 14 years ago

#429 closed defect (wontfix)

charset error with mysql

Reported by: rguerra@… Owned by: Brad Anderson
Priority: highest Component: DbAuthPlugin
Severity: blocker Keywords:
Cc: Trac Release: 0.11

Description (last modified by Alec Thomas)

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 18 years ago by Brad Anderson

Resolution: invalid
Status: newclosed

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

comment:2 Changed 18 years ago by Alec Thomas

Description: modified (diff)

comment:3 Changed 14 years ago by anonymous

Resolution: invalid
Status: closedreopened
Trac Release: 0.100.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 14 years ago by Ryan J Ollos

Resolution: wontfix
Status: reopenedclosed

Closing tickets for a deprecated plugin.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Brad Anderson.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.