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=B4t 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 =3D '10.99.29.9'
> admin =3D "cn=3Dldapadmin,o=3Dcnbg,c=3Dde"
> passw =3D "xxxxxxxx"
>
>
> l=3Dldap.open(server)
> l.protocol_version =3D ldap.VERSION3
> l.simple_bind_s(admin,passw)
>
> def e_ldapsearch(name,flag):
> basedn =3D "o=3Dcnbg,c=3Dde"
> sfilter =3D "(&(objectclass=3DdrupaPerson)(cn=3D%s))" %name
> res =3D 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': ''}
|