Error in ldapsearch??

Jens Vagelpohl jens at zope.com
Tue Dec 9 13:45:46 CET 2003


I suggest you move the code that connects to the server into the method.

jens

On Dec 9, 2003, at 5:41, Klinger Christian wrote:

> Hello List
>
> The Problem:
> I make some LDAP Queries (Zope External Method) over a large network!
> Sometimes i got a "good" result but sometimes i got the error
> "Can´t contact LDAP-Server"!
>
> Is it possible to get over on a "timeout limit"?
> Is it possible to trace something?
>
>
> Do you have any tips for me?
>
> Thx in advance
>
> Christian
>
> The "short code of the programm
>
> --snip--
> import ldap
>
> server = '10.99.29.9'
> admin  = "cn=ldapadmin,o=cnbg,c=de"
> passw  = "xxxxxxxx"
>
>
> l=ldap.open(server)
> l.protocol_version = ldap.VERSION3
> l.simple_bind_s(admin,passw)
>
> def e_ldapsearch(name,flag):
> 	basedn = "o=cnbg,c=de"
> 	sfilter = "(&(objectclass=drupaPerson)(cn=%s))" %name
> 	res = l.search_s(basedn, ldap.SCOPE_SUBTREE, sfilter) # line 72
> 	return res
> --snip--
>
> The Traceback from Zope:
>   __call__<BR>__traceback_info__: ((), {'flag': 'bgdpextranet', 'name':
>   9909040001}, None)
>   Module /opt/Zope/Extensions/e_ldapsearch.py, line 72, in ldapsearch
>   Module ldap.ldapobject, line 421, in search_s
>   Module ldap.ldapobject, line 425, in search_st
>   Module ldap.ldapobject, line 371, in result
>   Module ldap.ldapobject, line 94, in _ldap_call </LI></UL>SERVER_DOWN:
> {'desc': "Can't contact LDAP server", 'info': ''}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2355 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20031209/74117bc6/attachment.bin>


More information about the python-ldap mailing list