<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>Hmm.. I do not know enough about the&nbsp;SimpleLDAPObject&nbsp;code. Perhaps a python-ldap developer can provide more information (but I think they will recommend that you not use&nbsp;SimpleLDAPObject). Assigning to self may not work as you expect.&nbsp;I do not think you will be able to replace the&nbsp;SimpleLDAPObject inside an exception handler.</div><div><br></div><div>Creating a new LDAP connection using the same URIs as the original is valid logic, but your code will need to keep track of the state of pending LDAP requests and whether they have completed successfully, perhaps storing the requests in some sort of local database. The LDAP API itself does not provide for this sort of complex behavior. The level of redundancy you seek is not easy.</div><div><br></div><div>Yancey</div><div><br></div><br><div><div>On Mar 29, 2010, at 1:03 PM, Alberto Luengo Cabanillas (Pexego) wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<div bgcolor="#ffffff" text="#000000">
Yeargan, Yancey wrote:
<blockquote cite="mid:E05C60ED-331C-458D-BD17-13054D7D1741@unt.edu" type="cite">
  <div><br>
  </div>
  <div>I think it is as simple as using multiple URL values separated
with spaces. For example:</div>
  <div><br>
  </div>
  <div>ldap.initalize("url1 url2 url3")</div>
  <div><br>
  </div>
  <div>The underlying LDAP code will automatically try each URL until
one succeeds or they all fail.</div>
  <div><br>
  </div>
  <div>Yancey</div>
  <div><br>
  </div>
</blockquote>
Hi Yeargan. Thanks for the quick reply but that's not exactly the
problem we're facing. The point that if you initialize url1, url2 and
url3, with url1 down, the followup queries will be against url2. That's
a correct behaviour, but if while you're keeping up that connection,
this url2 server goes down, you'll get an exception, instead of trying
to reconnect to next available server (url1 or url3), supposing, of
course, that they have an equivalent structure.<br>
So, when this happens, we're initializing another LDAPObject with
remaining URIs this way:<br>
<br>
new_object =&nbsp;
ldap.functions._ldap_function_call(_ldap.initialize,string_uris)<br>
<br>
self = new_object (or self._l = new_object?)<br>
<br>
, but this still fails, any suggestion?<br>
<br>
Greetings.<br>
<br>
<blockquote cite="mid:E05C60ED-331C-458D-BD17-13054D7D1741@unt.edu" type="cite"><br>
  <div>
  <div>On Mar 29, 2010, at 9:41 AM, Alberto Luengo Cabanillas (Pexego)
wrote:</div>
  <br class="Apple-interchange-newline">
  <blockquote type="cite">
    <div bgcolor="#ffffff" text="#000000">Hi all! Me and a workmate are
currently working in an approach of
connecting to different LDAP servers (each one is a replica of another)
because of fault tolerancy purposes.<br>
So, first thing we did was modifying the <b>__init__</b> method of
SimpleLDAPObject class (ldapobject.py file) adding a new attribute
"pool" which contains the list&nbsp; of servers passed as param in <b>initialize</b>
method as a string. So, attribute .<b>_l </b>changes to: <br>
&nbsp;&nbsp;&nbsp; self._l =
ldap.functions._ldap_function_call(_ldap.initialize,self._pool[0])<br>
    <br>
Then, in <b>_ldap_call </b>we introduced a <i>while</i> loop
surrounding all code with a boolean condition set to False. When <b>"func"</b>
call fails raising a "SERVER_DOWN" exception, we remove URI from pool
and create a new ReconnectLDAPObject instance with self._l attribute
pointing to next LDAP URI in pool.<br>
    <br>
The problem we're actually facing is that when <b>func </b>calls
raises a SERVER_DOWN exception (with, for example, a <b>search_s</b>
operation) the code behaviour is correct when URI is wrong, but when
LDAP URI is right the func calls stills raises an exception...Is this
because of what is explained in the beginning of ReconnectLDAPObject
class (that synchronous methods like search_s() automatically tries to
reconnect when LDAP server is down)?.<br>
    <br>
Are we pointing in the right direction?<br>
    <br>
Thanks a lot in advance.<br>
    </div>
    <span>&lt;ATT00001..c&gt;</span><span>&lt;ATT00002..c&gt;</span></blockquote>
  </div>
  <br>
</blockquote>
<br>
</div>

</blockquote></div><br></body></html>