[Checkins] SVN: zc.ngi/trunk/ Bug Fixed:

Jim Fulton jim at zope.com
Thu Jul 22 12:57:25 EDT 2010


Log message for revision 114926:
  Bug Fixed:
  
  - There was a bug in handling connecting to testing servers that
    caused printing handlers to be used when they shouldn't have been.
  

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

-=-
Modified: zc.ngi/trunk/README.txt
===================================================================
--- zc.ngi/trunk/README.txt	2010-07-22 13:31:56 UTC (rev 114925)
+++ zc.ngi/trunk/README.txt	2010-07-22 16:57:25 UTC (rev 114926)
@@ -20,7 +20,7 @@
 *******
 
 ====================
-2.0.0a2 (2010-07-??)
+2.0.0a2 (2010-07-22)
 ====================
 
 New Features:
@@ -28,6 +28,14 @@
 - There's a new experimental zc.ngi.async.Implementation.listener
   option to run each client (server connection) in it's own thread.
 
+  (It's not documented. It's experimental, but there is a doctest.)
+
+Bugs Fixed:
+
+- There was a bug in handling connecting to testing servers that
+  caused printing handlers to be used when they shouldn't have been.
+
+
 ====================
 2.0.0a1 (2010-07-08)
 ====================

Modified: zc.ngi/trunk/src/zc/ngi/testing.py
===================================================================
--- zc.ngi/trunk/src/zc/ngi/testing.py	2010-07-22 13:31:56 UTC (rev 114925)
+++ zc.ngi/trunk/src/zc/ngi/testing.py	2010-07-22 16:57:25 UTC (rev 114926)
@@ -187,7 +187,7 @@
         if connections:
             return handler.connected(connections.pop(0))
     elif isinstance(connections, listener):
-        return handler.connected(connections.connect())
+        return connections.connect(addr, handler=handler)
     elif connections is _recursing:
         print (
             "For address, %r, a connect handler called connect from a\n"

Modified: zc.ngi/trunk/src/zc/ngi/tests.py
===================================================================
--- zc.ngi/trunk/src/zc/ngi/tests.py	2010-07-22 13:31:56 UTC (rev 114925)
+++ zc.ngi/trunk/src/zc/ngi/tests.py	2010-07-22 16:57:25 UTC (rev 114926)
@@ -552,7 +552,31 @@
 
     """
 
+def connect_to_a_testing_listener_shoulnt_use_printing_handler():
+    r"""
+If we use zc.ngi.testing.connect to connect to a registered listener,
+the printing handler shoudn't be used.
 
+    >>> import zc.ngi.testing, zc.ngi.adapters
+    >>> @zc.ngi.adapters.Lines.handler
+    ... def echo(connection):
+    ...     while 1:
+    ...         connection.write((yield).upper())
+
+    >>> listener = zc.ngi.testing.listener('a', echo)
+
+    >>> @zc.ngi.adapters.Lines.handler
+    ... def client(connection):
+    ...     connection.write('test\n')
+    ...     response = (yield)
+    ...     print 'client got', response
+
+    >>> zc.ngi.testing.connect('a', client)
+
+    >>> listener.close()
+    """
+
+
 if sys.version_info < (2, 6):
     del setHandler_compatibility
 



More information about the checkins mailing list