Django 1.4 と django-auth-ldap 1.1 を使用して、LDAP サービスに対してユーザーを認証するように Web アプリを構成しようとしています。ログインフォームで正しいログイン資格情報を提供すると、このエラーが発生します:-
/login/ での TypeError
整数が必要です
リクエスト方法: POST
リクエスト URL: http://mydomain.com:8000/login/
ジャンゴ バージョン: 1.4
例外の種類: TypeError
例外値:
整数が必要です
例外の場所: _ldap_function_call の 57 行目の /usr/lib/python2.6/dist-packages/ldap/functions.py Python 実行可能ファイル: /usr/bin/python
Python バージョン: 2.6.5
....Python パス情報
なぜこのエラーが発生するのですか?
ここに貼り付けられたトレース情報があります:-
Environment:
Request Method: POST
Request URL: http://localhost:8000/login/
Django Version: 1.4
Python Version: 2.6.5
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs',
'myapp')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/debug.py" in wrapper
69. return view(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/utils/decorators.py" in _wrapped_view
91. response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/cache.py" in _wrapped_view_func
89. response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/views.py" in login
36. if form.is_valid():
File "/usr/local/lib/python2.6/dist-packages/django/forms/forms.py" in is_valid
124. return self.is_bound and not bool(self.errors)
File "/usr/local/lib/python2.6/dist-packages/django/forms/forms.py" in _get_errors
115. self.full_clean()
File "/usr/local/lib/python2.6/dist-packages/django/forms/forms.py" in full_clean
271. self._clean_form()
File "/usr/local/lib/python2.6/dist-packages/django/forms/forms.py" in _clean_form
299. self.cleaned_data = self.clean()
File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/forms.py" in clean
167. password=password)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/__init__.py" in authenticate
43. for backend in get_backends():
File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/__init__.py" in get_backends
34. backends.append(load_backend(backend_path))
File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/__init__.py" in load_backend
28. return cls()
File "/usr/local/lib/python2.6/dist-packages/django_auth_ldap-1.1.1-py2.6.egg/django_auth_ldap/backend.py" in __init__
93. self.ldap = self.ldap_module()
File "/usr/local/lib/python2.6/dist-packages/django_auth_ldap-1.1.1-py2.6.egg/django_auth_ldap/backend.py" in ldap_module
104. return _LDAPConfig.get_ldap(options)
File "/usr/local/lib/python2.6/dist-packages/django_auth_ldap-1.1.1-py2.6.egg/django_auth_ldap/config.py" in get_ldap
74. cls.ldap.set_option(opt, value)
File "/usr/lib/python2.6/dist-packages/ldap/functions.py" in set_option
124. _ldap_function_call(_ldap.set_option,option,invalue)
File "/usr/lib/python2.6/dist-packages/ldap/functions.py" in _ldap_function_call
57. result = func(*args,**kwargs)
Exception Type: TypeError at /login/
Exception Value: an integer is required