Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #2453 (closed defect: worksforme)

Opened 9 years ago

Last modified 9 years ago

Error when logging out with non-ascii user name

Reported by: chrisz Owned by:
Priority: high Milestone: 2.1rc1
Component: TurboGears Version: trunk
Severity: blocker Keywords:


After some patches for #2438 it is now possible to log in with a non-ascii username. However, when I try to log out, I get exceptions like this one:

URL: http://localhost:8080/logout_handler
File '.../weberror-0.10.1-py2.6.egg/weberror/evalexception.py', line 431 in respond
  app_iter = self.application(environ, detect_start_response)
File '.../tg-dev/tg/configuration.py', line 760 in remover
  return app(environ, start_response)
File '.../repoze.tm2-1.0a5-py2.6.egg/repoze/tm/__init__.py', line 23 in __call__
  result = self.application(environ, save_status_and_headers)
File '.../repoze.who-1.0.18-py2.6.egg/repoze/who/middleware.py', line 133 in __call__
  app_iter = challenge_app(environ, start_response)
File '.../paste/httpexceptions.py', line 269 in wsgi_application
  headers, content = self.prepare_content(environ)
File '.../paste/trunk/paste/httpexceptions.py', line 244 in prepare_content
  content = self.html(environ)
File '.../paste/trunk/paste/httpexceptions.py', line 229 in html
  body = self.make_body(environ, self.template, html_quote, no_quote)
File '.../paste/trunk/paste/httpexceptions.py', line 205 in make_body
  args[k] = escfunc(v)
File '.../paste/trunk/paste/util/quoting.py', line 37 in html_quote
  return cgi.escape(unicode(v).encode(encoding), 1)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 330: ordinal not in range(128)

This seems to be caused by Paste trying to get a unicode representation of a webob.Request which has utf-8 chars in it. Unfortunately, Paste cannot deal with such requests (see  here).

In this case, the utf-8 char is in the cookie set by repoze.what.authtkt which includes the utf-8 encoded user name in the 'authtkt' cookie. (Maybe repoze.what.authtkt should better convert the cookie to a pure 7-bit representation like the standard Python Cookie lib does?)

The reason why Paste tries to get a representation of the request seems to have something to do with the add_dbsession_remover_middleware method in turbogears.configuration.

Change History

comment:1 in reply to: ↑ description Changed 9 years ago by Gustavo

Replying to chrisz:

In this case, the utf-8 char is in the cookie set by repoze.what.authtkt which includes the utf-8 encoded user name in the 'authtkt' cookie.

Just a quick correction: It's a repoze.who built-in plugin (auth_tkt) the one in charge of that. ;-)

comment:2 Changed 9 years ago by mramm

  • Milestone changed from 2.1 to 2.1b2

comment:7 Changed 9 years ago by percious

  • Severity changed from normal to blocker

comment:8 Changed 9 years ago by percious

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

Tried with the latest r.who-ff and r.who and r.why.why.why

Note: See TracTickets for help on using tickets.