﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
6919	LDAP not working (not authentication)	Raoul Thill <raoul.thill@…>	nobody	"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?"		closed	Core (Other)	0.96		invalid			Unreviewed	0	0	0	0	0	0
