Modify

Opened 8 years ago

Closed 4 years ago

#429 closed defect (wontfix)

charset error with mysql

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

Description (last modified by athomas)

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 8 years ago by brad

  • Resolution set to invalid
  • Status changed from new to closed

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 8 years ago by athomas

  • Description modified (diff)

comment:3 Changed 5 years ago by anonymous

  • Resolution invalid deleted
  • Status changed from closed to reopened
  • Trac Release changed from 0.10 to 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 4 years ago by rjollos

  • Resolution set to wontfix
  • Status changed from reopened to closed

Closing tickets for a deprecated plugin.

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from brad. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.