Code

Opened 6 years ago

Closed 6 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:

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?

Attachments (0)

Change History (1)

comment:1 Changed 6 years ago by jacob

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.