python-ldap and openldap 2.07

Jens Vagelpohl jens at digicool.com
Sat May 12 15:44:24 CEST 2001


donal,

> Basically I'm writing some code for the Mailman mailing list software, so
> that it can do authentication, subscription, etc by LDAP. Have the
> authentication
> working after some initial playing with the python-ldap module, but I can't
> for the life of me modify any values in the ldap directory.

i'm ctually very interested in having mailman get auth info from ldap
myself. mind sharing your experiences / code? i haven't gotten to even
looking at mailman yet, but it will be a requirement for all zope-related
mailing lists real soon now.


> *I may just be just making errors in my code, but i'm nearly sure i'm not*
> the line of code i'm using:
> res = l.modify_s(user_dn, [(MOD_REPLACE, 'userPassword', [new_pw])])
> where:
> user_dn = cn=huntd2,ou=RedGiant,o=DCU
> new_pw = newpw
> 
> is there a way to get the LDAP error codes back from the python-ldap module??

take a look at the manage_editUserPassword method in the LDAPUserManager
module here:

http://cvs.dataflake.org/LDAPUserManager/LDAPUserManager.py?rev=1.27&content
-type=text/vnd.viewcvs-markup

the call to modify_s is wrapped in a try/except and if an exception occurs i
catch it and feed it to a formatting routine so i can return it back to a
web page. the code is pretty zope-specific, but you can see the pattern.

jens





More information about the python-ldap mailing list