Opened 10 years ago

Closed 10 years ago

#6919 closed (invalid)

LDAP not working (not authentication)

Reported by: Raoul Thill <raoul.thill@…> 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: UI/UX:



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

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/" in get_response
  77. response = callback(request, *callback_args, **callback_kwargs)
File "/home/rthill/workspace/ldapAdmin/django_ldapAdmin/../django_ldapAdmin/ldap/" 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 ( working in django 0.96.1, or what am I doing wrong?

Change History (1)

comment:1 Changed 10 years ago by Jacob

Resolution: invalid
Status: newclosed

Please take this question to django-users -- this isn't a bug in Django, and usage questions should be directed to the mailing list.

Note: See TracTickets for help on using tickets.
Back to Top