gdub/python-simpleldap — pull request #1 by drr00t (2013-04-18 14:30:05+00:00)
Title: few minor changes...

Hi,

I liked pretty much of your project, thanks for share. I use, but for this i made two changes to simplify my final code, 1) i create a method to allow authenticate an user without have to create new connection, 2) I defined default values for hostname and port.

1) now i can:

# here i using new constructor
with simpleldap.Connection(dn=self.ldap_user, password=self.ldap_pass) as conn:
user = conn.get(u'%s=%s' % (self.ldap_user_auth_field, user_uid), base_dn=self.ldap_user_subtree)

# here i using new method
if user and conn.user_validate(dn_user=user.dn, password=password):
return True
return False

thanks again.