Commit af429693 authored by Nicolas Delaby's avatar Nicolas Delaby

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
parent 5a4593b3
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment