Comment 0 for bug 1363804

Revision history for this message
François Marier (fmarier) wrote : Exception while logging OpenID error with UTF-8 URLs

When the OpenID discovery fails with a "consumer.DiscoveryFailure", an error message is printed to the logs.

However, that error message causes an exception if the OpenID URL contains non-ASCII characters like this one:

  https://plus.google.com/Exämple

Here's the error from the Django logs:

Traceback (most recent call last):

  File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 109, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/usr/lib/python2.7/dist-packages/django/contrib/auth/decorators.py", line 20, in _wrapped_view
    return view_func(request, *args, **kwargs)

  File "/usr/share/libravatar/libravatar/account/views.py", line 289, in redirect_openid
    print "OpenID discovery failed (userid=%s) for %s" % (request.user.id, user_url)

UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 73: ordinal not in range(128)