Opened 17 years ago
Closed 17 years ago
#6919 closed (invalid)
LDAP not working (not authentication)
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (Other) | Version: | 0.96 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hi,
I'm trying to build a LDAP administration tool based on django to add, list, modify and delete users from an LDAP tree, but my app is failing with exception: 'module' object has no attribute 'initialize'
My code simply looks like this in the views.py:
import ldap from django.shortcuts import render_to_response, get_object_or_404, HttpResponse from django.http import HttpResponseRedirect #from datetime import datetime from django_ldapAdmin.ldap.models import Config def test(request): dn = 'ou=Users,o=local,c=lu' conn = ldap.initialize('ldap://localhost:389') conn.simple_bind_s('cn=Manager,p=local,c=lu', 'secret') filter = '(objectClass=person)' attrs = ['sn', 'givenName', 'uid'] raw = self.conn.search_s(dn, ldap.SCOPE_ONELEVEL, filter, attrs) print raw render_to_response('ldapUserList.django.html', {'user_list': raw})
And the traceback has the following content:
Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py" in get_response 77. response = callback(request, *callback_args, **callback_kwargs) File "/home/rthill/workspace/ldapAdmin/django_ldapAdmin/../django_ldapAdmin/ldap/views.py" in test 42. conn = ldap.initialize('ldap://localhost:389') AttributeError at /test/ 'module' object has no attribute 'initialize'
What more data can or should I submit to get module ldap (http://python-ldap.sourceforge.net) working in django 0.96.1, or what am I doing wrong?
Note:
See TracTickets
for help on using tickets.
Please take this question to django-users -- this isn't a bug in Django, and usage questions should be directed to the mailing list.