Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Commit

Permalink
Bug Fixed:
Browse files Browse the repository at this point in the history
- There was a bug in handling connecting to testing servers that
  caused printing handlers to be used when they shouldn't have been.
  • Loading branch information
Jim Fulton committed Jul 22, 2010
1 parent e3d61c4 commit ec9bf9a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
10 changes: 9 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,22 @@ Changes
*******

====================
2.0.0a2 (2010-07-??)
2.0.0a2 (2010-07-22)
====================

New Features:

- 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)
====================
Expand Down
2 changes: 1 addition & 1 deletion src/zc/ngi/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def connect(addr, handler):
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"
Expand Down
24 changes: 24 additions & 0 deletions src/zc/ngi/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,30 @@ def EXPERIMENTAL_thready_async_servers():
"""

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
Expand Down

0 comments on commit ec9bf9a

Please sign in to comment.