From af429693f9db16261ece49b5f45e17c3d68fe2b4 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Fri, 15 Feb 2008 09:25:56 +0000
Subject: [PATCH] revert r19313 where usage of _ping is too slow Add method to
 get New Connection

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19322 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ZLDAPConnection/ZLDAP.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/product/ZLDAPConnection/ZLDAP.py b/product/ZLDAPConnection/ZLDAP.py
index 902f317ac2..6f4d1676a2 100644
--- a/product/ZLDAPConnection/ZLDAP.py
+++ b/product/ZLDAPConnection/ZLDAP.py
@@ -358,7 +358,7 @@ class ZLDAPConnection(
     ### connection checking stuff
 
     def _connection(self):
-        if self.openc:
+        if self.getOpenConnection():
             if not self.isOpen(): self._open()
             return self._v_conn
         else:
@@ -366,14 +366,19 @@ class ZLDAPConnection(
 
     GetConnection=_connection
 
+    def getForcedConnection(self):
+        if self.getOpenConnection():
+            self._open()
+            return self._v_conn
+        else:
+            raise ConnectionError, 'Connection Closed'
+
     def isOpen(self):
         " quickly checks to see if the connection's open "
         if getattr(aq_base(self), '_v_conn', None) is None:
             self._v_conn = None
         if self._v_conn is None or not self.shouldBeOpen():
             return 0
-        elif not self.__ping():
-            return 0
         else:
             return 1
 
-- 
2.30.9