Hi, I have a file called ldap whit the following code:
class Ldap(object):
def __init__(self,usuario=None, passwd=None):
self.objLDAP = None
self.dir = 'xx.xx.xx.xx'
self.ldap_host = 'xxx.xx'
self.puerto = 389
self.AD_SEARCH_DN = 'OU=xxx Domain Users,DC=xxx,DC=xx'
self.usuario = usuario
self.passwd = passwd
self.AD_SEARCH_FIELDS = ['displayname', 'mail','apart',
'mailnickname', 'title']
self.AD_LDAP_URL = 'ldap://%s:%s' % (self.dir, self.puerto)
def Conectar(self):
try:
self.objLDAP = ldap.initialize(self.AD_LDAP_URL)
if self.objLDAP:
if self.usuario and self.passwd:
autUser = self.objLDAP.simple_bind_s("%...@%s"%
(self.usuario, 'xxx.xx'), self.passwd)
if autUser:
return True
else:
return False
else:
return False
else:
return False
except error:
pass
I want agregate this file to login methods but when I wrote
auth.settings.login_methods.append(Ldap()), the web2py send me an
error.
this is the error: 'Ldap' object is not callable.
How I solve this problem??
thank for your help