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( ...@@ -358,7 +358,7 @@ class ZLDAPConnection(
### connection checking stuff ### connection checking stuff
def _connection(self): def _connection(self):
if self.openc: if self.getOpenConnection():
if not self.isOpen(): self._open() if not self.isOpen(): self._open()
return self._v_conn return self._v_conn
else: else:
...@@ -366,14 +366,19 @@ class ZLDAPConnection( ...@@ -366,14 +366,19 @@ class ZLDAPConnection(
GetConnection=_connection GetConnection=_connection
def getForcedConnection(self):
if self.getOpenConnection():
self._open()
return self._v_conn
else:
raise ConnectionError, 'Connection Closed'
def isOpen(self): def isOpen(self):
" quickly checks to see if the connection's open " " quickly checks to see if the connection's open "
if getattr(aq_base(self), '_v_conn', None) is None: if getattr(aq_base(self), '_v_conn', None) is None:
self._v_conn = None self._v_conn = None
if self._v_conn is None or not self.shouldBeOpen(): if self._v_conn is None or not self.shouldBeOpen():
return 0 return 0
elif not self.__ping():
return 0
else: else:
return 1 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