[Checkins] SVN: zc.ngi/trunk/ Bugs fixed:

Jim Fulton jim at zope.com
Mon Jun 29 13:15:58 EDT 2009


Log message for revision 101328:
  Bugs fixed:
  
  - zc.ngi.blocking didn't properly handle connection failures.
  

Changed:
  U   zc.ngi/trunk/README.txt
  U   zc.ngi/trunk/src/zc/ngi/blocking.py
  U   zc.ngi/trunk/src/zc/ngi/tests.py

-=-
Modified: zc.ngi/trunk/README.txt
===================================================================
--- zc.ngi/trunk/README.txt	2009-06-29 16:53:16 UTC (rev 101327)
+++ zc.ngi/trunk/README.txt	2009-06-29 17:15:58 UTC (rev 101328)
@@ -17,6 +17,14 @@
 *******
 
 ==================
+1.1.1 (2009-06-29)
+==================
+
+Bugs fixed:
+
+- zc.ngi.blocking didn't properly handle connection failures.
+
+==================
 1.1.0 (2009-05-26)
 ==================
 

Modified: zc.ngi/trunk/src/zc/ngi/blocking.py
===================================================================
--- zc.ngi/trunk/src/zc/ngi/blocking.py	2009-06-29 16:53:16 UTC (rev 101327)
+++ zc.ngi/trunk/src/zc/ngi/blocking.py	2009-06-29 17:15:58 UTC (rev 101328)
@@ -34,7 +34,7 @@
 
 def connect(address, connect, timeout=None):
     return _connector().connect(address, connect, timeout)
-    
+
 class _connector:
 
     failed = connection = None
@@ -48,12 +48,12 @@
         if self.connection is not None:
             return self.connection
         raise ConnectionTimeout()
-    
+
     def connected(self, connection):
         self.connection = connection
         self.event.set()
 
-    def failed_connect(reason):
+    def failed_connect(self, reason):
         self.failed = reason
         self.event.set()
 
@@ -108,14 +108,14 @@
         if not self._closed:
             self._connection.write(zc.ngi.END_OF_DATA)
         self._closed = True
-            
+
     def write(self, data):
         self._check_exception()
         self._check_open()
         assert isinstance(data, str)
         self._position += len(data)
         self._connection.write(data)
-            
+
     def writelines(self, data, timeout=None, nonblocking=False):
         self._check_exception()
         self._check_open()
@@ -178,7 +178,7 @@
         self._data += data
         condition.notifyAll()
         condition.release()
-        
+
     def handle_close(self, connection, reason):
         condition = self._condition
         condition.acquire()
@@ -306,6 +306,6 @@
             self._condition.wait()
 
         self._outputfile._check_exception()
-        
+
         return timeout, deadline
-        
+

Modified: zc.ngi/trunk/src/zc/ngi/tests.py
===================================================================
--- zc.ngi/trunk/src/zc/ngi/tests.py	2009-06-29 16:53:16 UTC (rev 101327)
+++ zc.ngi/trunk/src/zc/ngi/tests.py	2009-06-29 17:15:58 UTC (rev 101328)
@@ -51,6 +51,16 @@
 
     """
 
+def blocking_connector_handles_failed_connect():
+    """
+    >>> import zc.ngi.blocking
+    >>> zc.ngi.blocking.open(('localhost', 42), zc.ngi.testing.connect)
+    Traceback (most recent call last):
+    ...
+    ConnectionFailed: no such server
+
+    """
+
 class BrokenConnect:
 
     connected = failed_connect = __call__ = lambda: xxxxx



More information about the Checkins mailing list