First time here? Check out the FAQ!

Revision history  [back]

Exception with ldap signin when the password includes accented characters

When the password of the user contains an accented character like "à" or "ç" for instance, the following exception is raised :

/data/local/virtualenv/askbot/lib/python2.6/site-packages/askbot/middleware/pagesize.py TIME: 2011-06-27 01:57:29,526 MSG: pagesize.py:process_exception:43   File "/data/local/virtualenv/askbot/lib/python2.6/site-packages/django/core/handlers/base.py", line 99, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/data/local/virtualenv/askbot/lib/python2.6/site-packages/django/utils/decorators.py", line 48, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/data/local/virtualenv/askbot/lib/python2.6/site-packages/askbot/deps/django_authopenid/views.py", line 317, in signin
    login_form.cleaned_data['password']
  File "/data/local/virtualenv/askbot/lib/python2.6/site-packages/askbot/deps/django_authopenid/util.py", line 643, in ldap_check_password
    ldap_session.simple_bind_s(username, password)
  File "/data/local/virtualenv/askbot/lib/python2.6/site-packages/ldap/ldapobject.py", line 206, in simple_bind_s
    msgid = self.simple_bind(who,cred,serverctrls,clientctrls)
  File "/data/local/virtualenv/askbot/lib/python2.6/site-packages/ldap/ldapobject.py", line 200, in simple_bind
    return self._ldap_call(self._l.simple_bind,who,cred,EncodeControlTuples(serverctrls),EncodeControlTuples(clientctrls))
  File "/data/local/virtualenv/askbot/lib/python2.6/site-packages/ldap/ldapobject.py", line 96, in _ldap_call
    result = func(*args,**kwargs)

/data/local/virtualenv/askbot/lib/python2.6/site-packages/askbot/middleware/pagesize.py TIME: 2011-06-27 01:57:29,527 MSG: pagesize.py:process_exception:44 <type 'exceptions.UnicodeEncodeError'>
/data/local/virtualenv/askbot/lib/python2.6/site-packages/askbot/middleware/pagesize.py TIME: 2011-06-27 01:57:29,527 MSG: pagesize.py:process_exception:45 'ascii' codec can't encode character u'\xe7' in position 0: ordinal not in range(128)
/data/local/virtualenv/askbot/lib/python2.6/site-packages/askbot/middleware/pagesize.py TIME: 2011-06-27 01:57:29,527 MSG: pagesize.py:process_exception:54 path: /account/signin/
method: POST
data: <QueryDict: {u'username': [u'user'], u'openid_login_token': [u''], u'password_action': [u'login'], u'next': [u'/'], u'login_provider_name': [u'local'], u'login_with_password': [u'Sign in'], u'csrfmiddlewaretoken': [u'e630f38ee4a67878c8e28d1cd6411ac0'], u'password': [u'XXXXXX']}>
host: ask
user: AnonymousUser

My askbot server is running on a redhat distribution.

Exception with ldap signin when the with password includes including accented characters

When the password of the user contains an accented character like "à" or "ç" for instance, the following exception is raised :

/data/local/virtualenv/askbot/lib/python2.6/site-packages/askbot/middleware/pagesize.py TIME: 2011-06-27 01:57:29,526 MSG: pagesize.py:process_exception:43   File "/data/local/virtualenv/askbot/lib/python2.6/site-packages/django/core/handlers/base.py", line 99, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/data/local/virtualenv/askbot/lib/python2.6/site-packages/django/utils/decorators.py", line 48, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/data/local/virtualenv/askbot/lib/python2.6/site-packages/askbot/deps/django_authopenid/views.py", line 317, in signin
    login_form.cleaned_data['password']
  File "/data/local/virtualenv/askbot/lib/python2.6/site-packages/askbot/deps/django_authopenid/util.py", line 643, in ldap_check_password
    ldap_session.simple_bind_s(username, password)
  File "/data/local/virtualenv/askbot/lib/python2.6/site-packages/ldap/ldapobject.py", line 206, in simple_bind_s
    msgid = self.simple_bind(who,cred,serverctrls,clientctrls)
  File "/data/local/virtualenv/askbot/lib/python2.6/site-packages/ldap/ldapobject.py", line 200, in simple_bind
    return self._ldap_call(self._l.simple_bind,who,cred,EncodeControlTuples(serverctrls),EncodeControlTuples(clientctrls))
  File "/data/local/virtualenv/askbot/lib/python2.6/site-packages/ldap/ldapobject.py", line 96, in _ldap_call
    result = func(*args,**kwargs)

/data/local/virtualenv/askbot/lib/python2.6/site-packages/askbot/middleware/pagesize.py TIME: 2011-06-27 01:57:29,527 MSG: pagesize.py:process_exception:44 <type 'exceptions.UnicodeEncodeError'>
/data/local/virtualenv/askbot/lib/python2.6/site-packages/askbot/middleware/pagesize.py TIME: 2011-06-27 01:57:29,527 MSG: pagesize.py:process_exception:45 'ascii' codec can't encode character u'\xe7' in position 0: ordinal not in range(128)
/data/local/virtualenv/askbot/lib/python2.6/site-packages/askbot/middleware/pagesize.py TIME: 2011-06-27 01:57:29,527 MSG: pagesize.py:process_exception:54 path: /account/signin/
method: POST
data: <QueryDict: {u'username': [u'user'], u'openid_login_token': [u''], u'password_action': [u'login'], u'next': [u'/'], u'login_provider_name': [u'local'], u'login_with_password': [u'Sign in'], u'csrfmiddlewaretoken': [u'e630f38ee4a67878c8e28d1cd6411ac0'], u'password': [u'XXXXXX']}>
host: ask
user: AnonymousUser

My askbot server is running on a redhat distribution.